Ubuntu 20.04
Sponsored Link

Kubernetes : Configure Master Node
Install Kubeadm to Configure Multi Nodes Kubernetes Cluster.
This example is based on the emvironment like follows.
           |                           |                          |
       eth0|              eth0|             eth0|
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ dlp.srv.world ]  |   | [ node01.srv.world ] |   | [ node02.srv.world ] |
|      Master Node     |   |      Worker Node     |   |      Worker Node     |
+----------------------+   +----------------------+   +----------------------+

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)
  ⇒ https://kubernetes.io/docs/concepts/cluster-administration/networking/
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=

W0818 14:18:23.411218    5697 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.18.8
[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] Starting the kubelet
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[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 2ai7nw.g02n51jp4ak0i63j \
    --discovery-token-ca-cert-hash sha256:19d10da61c574672cb292f33c56d246da8615d29bbf9cbf2d7152140caa27e8b

# 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 https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel 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

dlp.srv.world   Ready    master   7m7s   v1.18.8

# show state ⇒ OK if all are Running

kubectl get pods -A

NAMESPACE     NAME                                    READY   STATUS    RESTARTS   AGE
kube-system   coredns-66bff467f8-968bw                1/1     Running   0          7m47s
kube-system   coredns-66bff467f8-xd2m7                1/1     Running   0          7m47s
kube-system   etcd-dlp.srv.world                      1/1     Running   0          7m56s
kube-system   kube-apiserver-dlp.srv.world            1/1     Running   0          7m55s
kube-system   kube-controller-manager-dlp.srv.world   1/1     Running   0          7m56s
kube-system   kube-flannel-ds-amd64-k8fbp             1/1     Running   0          85s
kube-system   kube-proxy-h588r                        1/1     Running   0          7m47s
kube-system   kube-scheduler-dlp.srv.world            1/1     Running   0          7m56s
Matched Content