Install k8s single node cluster using minikube

what is minikube

minikube is a tool to quickly start a virtual machine on a local laptop to build a kubernets single-node kubernetes cluster. Because of some network reasons, I use the minikube modified by Alibaba Cloud here.

Install

First of all, you have to make sure that virtualbox is installed locally. If you are using linux, even virtualbox can directly support the installation of k8s on the host without installation. Then install curl -Lo minikube http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v0.25.2/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/it. Now execute minikube versionit. If the version of minikube can be displayed, the installation is successful.

The first k8s cluster in my life

The next step is to create a cluster minikube start --vm-driver=virtualbox --registry-mirror=https://registry.docker-cn.com--vm-driver means what virtual machine are you using, because I use virtualbox, so the parameter is virtualbox and --registry-mirror must be added, you know in China

➜  temp  minikube start --vm-driver=virtualbox --registry-mirror=https://registry.docker-cn.com
Starting local Kubernetes v1.9.4 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Downloading localkube binary
 163.02 MB / 163.02 MB [============================================] 100.00% 0s
 0 B / 65 B [----------------------------------------------------------]   0.00%
 65 B / 65 B [======================================================] 100.00% 0sSetting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

If you don't have kubectl installed, there will be a prompt saying that kubectl is not installed, then install it, but you need to use the proxy to find a way to download the binary file first proxychains wget https://storage.googleapis.com/kubernetes-release/release/v1.9.4/bin/linux/amd64/kubectl, then give the executable permission chmod +x kubectl, move the path sudo mv kubectl /usr/bin, and then kubectl versionverify whether it is After success, let kubectl use the minikube configuration file and kubectl config use-context minikubethen view the cluster informationkubectl cluster-info

➜  .kube kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

After that, you can visit the ip:8443 of your master node to see if it is successful, and you can also open virtualbox to see if there is a virtual machine called minikube running

Then you check if the containers in the cluster are runningkubectl get pods --all-namespaces

➜  temp kubectl get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS    RESTARTS   AGE
kube-system   kube-addon-manager-minikube             1/1       Running   0          3m
kube-system   kube-dns-7cd4f8cd9f-mtkqk               3/3       Running   0          2m
kube-system   kubernetes-dashboard-7b7c7bd496-9m9cf   1/1       Running   0          2m
kube-system   storage-provisioner                     1/1       Running   0          2m

If it is normal, then the status is running, otherwise it shows that the container is being created, which means that there may be some problems with the network. Then use the command minikube dashboardto view the address of your k8s dashboard, which is usually opened directly in the default browser.

Welcome to follow Bboysoul's blog www.bboysoul.com Have Fun

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325063962&siteId=291194637