LYLIANSONG YEWORK / LIFE / BOOKS

Tools / 2020.03.14

kubeadm concept and practice

1. kubeadm knowledge map

Kubeadm is a tool to implement the k8s environment quickly. Also you don't need to care about the configure environment, just know how to bootstrap it. Master the basically command to use kubeadm.

2. Kubeadm practice

2.1 The practice environment

Google cloud instance Linux system.

2.2 Environment configure

2.3 kubeadm practice

Background: Use kubeadm to create the k8s master node, then loop other nodes to this master node.

pod-network-cidr, means identify the pod ip range, also we use the flannel network design solution. Ignore, means ignore the error when startup. Because when start up kubeadm, perhaps hit the hardware uncomfortable.

As we know, kubectl is the command tool to control kubernetes cluster. When we switch to the master node, we need to configure the kubectl. > ``bash > mkdir -p $HOME/.kube > cp -i /etc/kubernetes/admin.conf $HOME/.kube/config > chown $(id -u):$(id -g) $HOME/.kube/config > echo export KUBECONFIG=~/.kube/config>> ~/.bashrc > source ~/.bashrc > ``

3. Additional

Actually there are many issues when you follow the steps. Unsolved problems:

The solution: I misunderstood the concept of kubeadm, So hit this issue. Actually, kubeadm aims to create the implement the k8s environment, so it will create the kubenetes master node when you execute the kubeadm init command. Then you can arrange other nodes to this master node. So my solution is like this.

At first, create a new instance, then in this instance configure the container, kubectl, kubelet and kubeadm tools. After this, execute this command. > `` > kubeadm join --token 5dhzcw.h7aih16mg982ms2o 10.128.0.2:6443 --discovery-token-ca-cert-hash sha256:e9e6843a6ae6fc5fb8acb9f116bc58d1c1e0f30d1da9bfe3bf151319c3788d57 --ignore-preflight-errors=all > ``

Certainly, you must be the root role. The result is below.

You can download the master node, "/etc/kubernetes/admin.conf", then copy this file to the node machine path "/etc/kubernetes/". Then follow the previous steps to configure the kubectl.

https://kubernetes.io/docs/setup/production-environment/container-runtimes/#docker

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/

END继续阅读 →