1 introduction
Kubernetes, also known as K8S, is Google’s open source container cluster management system, which is also popular recently. Having nothing to do (in order to post), I tinker a bit, build Kubernetes on Mac, and record some pits when I meet them.
In addition, docker-related concepts can be referred to the following article: Introduction to Docker — understand the core concepts of Docker.
Kubernetes is starting
2.1 stuck in starting
After Docker Desktop is installed on your Mac, you can start Docker. To start Kubernetes, you need Enable.
Kubernetes is starting, Kubernetes is starting, Kubernetes is starting Because of network problems (you know), the image needed to start Kubernetes could not be downloaded.
2.2 Downloading an Image
The required image can be manually downloaded one by one, of course, there are also people prepared scripts can be downloaded one click, the script is in the warehouse: github.com/hummerstudi… On.
Clone the warehouse:
$ git clone https://github.com/hummerstudio/k8s-docker-desktop-for-mac.gitCopy the code
Then check whether the version on the file image_list is compatible with the version you installed. It is recommended to directly update the Docker Desktop to the latest version.
$cat image_list k8s. GCR. IO/kube - proxy: v1.16.5 = gotok8s/kube - proxy: v1.16.5 K8s. GCR. IO/kube - controller - manager: v1.16.5 = gotok8s/kube - controller - manager: v1.16.5 K8s. GCR. IO/kube - the scheduler: v1.16.5 = gotok8s/kube - the scheduler: v1.16.5 K8s. GCR. IO/kube - apiserver: v1.16.5 = gotok8s/kube - apiserver: v1.16.5 k8s. GCR. IO/coredns: 1.6.2 = gotok8s/coredns: 1.6.2 K8s. GCR. IO/pause: 3.1 = gotok8s/pause: 3.1 k8s. GCR. IO/etcd: 3.3.15-0 = gotok8s/etcd: 3.3.15-0 K8s. GCR. IO/kubernetes - dashboard - amd64 = gotok8s/kubernetes - dashboard - amd64: v1.10.1Copy the code
Version 1.16.5:
There is no problem executing the script to pull the image:
$ ./load_images.shCopy the code
2.3 Verifying the Restart
After downloading, restart Kubernetes and verify Kubernetes cluster status:
$ kubectl cluster-info
$ kubectl get nodes
$ kubectl describe nodeCopy the code
The installation Dashboard
The Dashboard is not required, it is easy to view and operate, it is recommended to install. The file (raw.githubusercontent.com/kubernetes/…). Download it to a local directory and run the following command:
$ kubectl apply -f recommended.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper createdCopy the code
Activation:
$ kubectl proxyCopy the code
You are advised to run the following command to start the terminal. Otherwise, the terminal will be occupied:
$ nohup kubectl proxy >/dev/null &Copy the code
Starts to visit: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
The interface is as follows:
To obtain the Token, run the following command:
$ kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}' eyJhbGciOiJSUzI1NiIsImtpZCI6IjNiT1o4eW5ORHpkVlp6Q2VJakxMOENlZEUxSU16YmRZcHZqV3BfXzhQTm8ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3Nlc nZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZ WFjY291bnQvc2VjcmV0Lm5hbWUiOiJkZWZhdWx0LXRva2VuLTJoNnpkIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQub mFtZSI6ImRlZmF1bHQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJhODk5MDkwMS1hOWE4LTQyZTAtOGMxN i1iNmQwZTY1NjgyZTEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGVmYXVsdCJ9.Oo1Sa5GcWC7SknJ_qoGgoIXyGJKIp1nB 4ApZqvTsj32DcoAA4mBmo0VB_zqdmlG0x29FO132x_6I2ejOnCwZ9IRlUWBtEYsKCChZb9kUjbAA9FLyIln4AW0K3V7F1ns_YIKLYaudnkHJPWpqE2FXwTVD s-ZpGgUUk2Fs-Sw8KEFOLnHNFzi-lIajsbicmUMyKPimcv51vN-Mgc9gH-_PfvLKBL-h3vbsCep-0xsRE2zOtsfqv9cbaVNhFaYkVvZuYzCBD1TY9v5Q5R6j PsB2IBZzEYMKw8lHGNrPzN0vrKCM_VBRSeUgzUnjAH6MLuVVWbzBmYYiOluCjuAyKf1eWACopy the code
You can log in via Token. The Dashboard interface is as follows:
4 summarizes
At this point, the installation is complete, and a small example will explain how to use it. Note that my computer is connected to ali Cloud’s mirror warehouse, please automatically set Google. If you want to play k8S, there are other ways to build environments, such as Minikube.
Visit pumpkin Talk www.pkslow.com for more exciting articles!
Welcome to pay attention to the wechat public number “Pumpkin slow Talk”, will continue to update for you…
Read more and share more; Write more. Organize more.