Debian 10 Buster
Sponsored Link

Kubernetes : Kubeadm : Configure Master Node2019/08/26

Install Kubeadm to Configure Multi Nodes Kubernetes Cluster.
On this example, Configure This example is based on the emvironment like follows.
For System requirements, each Node has uniq Hostname, MAC address, Product_uuid.
MAC address and Product_uuid are generally already uniq one if you installed OS on phisical machine or virtual machine with common procedure. You can see Product_uuid with the command [dmidecode -s system-uuid].
           |                           |                          |
       eth0|              eth0|             eth0|
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ ]  |   | [ ] |   | [ ] |
|      Master Node     |   |      Worker Node     |   |      Worker Node     |
+----------------------+   +----------------------+   +----------------------+

Configure Master Node on this section.
Configure initial setup on Master Node.
For [--apiserver-advertise-address] option, specify the IP address Kubernetes API server listens.
For [--pod-network-cidr] option, specify network which Pod Network uses.
There are some plugins for Pod Network. (refer to details below)
On this example, select Flannel. For Flannel, specify [--pod-network-cidr=] to let Pod Network work normally.
kubeadm init --apiserver-advertise-address= --pod-network-cidr=

[init] Using Kubernetes version: v1.15.3
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Activating the kubelet service
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:

Then you can join any number of worker nodes by running the following on each as root:

# the command below is necessary to run on Worker Node when he joins to the cluster, so remember it
kubeadm join --token uw8h1x.4vjex3g6tfgt4w2t \
    --discovery-token-ca-cert-hash sha256:99c192dcb2b38438c4aacc5029b86447f18f2b93a0fe0fa7a779192bc952fb53

# set cluster admin user

# if you set common user as cluster admin, login with it and run [sudo cp/chown ***]

mkdir -p $HOME/.kube

cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

chown $(id -u):$(id -g) $HOME/.kube/config
[3] Configure Pod Network with Flannel.
kubectl apply -f

podsecuritypolicy.policy/psp.flannel.unprivileged created created created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds-amd64 created
daemonset.apps/kube-flannel-ds-arm64 created
daemonset.apps/kube-flannel-ds-arm created
daemonset.apps/kube-flannel-ds-ppc64le created
daemonset.apps/kube-flannel-ds-s390x created

# show state (OK if STATUS = Ready)

kubectl get nodes

NAME            STATUS   ROLES    AGE    VERSION   Ready    master   3m2s   v1.15.3

# show state (OK if all are Running)

kubectl get pods --all-namespaces

NAMESPACE     NAME                                    READY   STATUS    RESTARTS   AGE
kube-system   coredns-5c98db65d4-46w67                1/1     Running   0          2m56s
kube-system   coredns-5c98db65d4-klfb2                1/1     Running   0          2m56s
kube-system                      1/1     Running   0          116s
kube-system            1/1     Running   0          115s
kube-system   1/1     Running   0          2m8s
kube-system   kube-flannel-ds-amd64-pgf88             1/1     Running   0          30s
kube-system   kube-proxy-zd77s                        1/1     Running   0          2m57s
kube-system            1/1     Running   0          2m3s
Matched Content