Ubuntu 18.04
Sponsored Link

Kubernetes : Kubeadm : Configure Master Node
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|
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ dlp.srv.world ]  |   | [ node01.srv.world ] |   | [ node02.srv.world ] |
|      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)
  ⇒ 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=

[init] using Kubernetes version: v1.12.1
[preflight] running pre-flight checks
[preflight/images] Pulling images required for setting up a Kubernetes cluster
[preflight/images] This might take a minute or two, depending on the speed of your internet connection
[preflight/images] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[preflight] Activating the kubelet service
[certificates] Generated etcd/ca certificate and key.
[certificates] Generated etcd/healthcheck-client certificate and key.
[certificates] Generated etcd/server certificate and key.


Your Kubernetes master 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:

You can now join any number of machines by running the following on each node
as root:

  # the command below is necessary to run on Worker Node when he joins to the cluster, so remember it
  kubeadm join --token nvr822.tjn09e85qw3a3vuz --discovery-token-ca-cert-hash sha256:866f645d9ec0da07f778b3c4abc4427e9967845d71add3252fbd691b86c0a9a7

# 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

clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.extensions/kube-flannel-ds-amd64 created
daemonset.extensions/kube-flannel-ds-arm64 created
daemonset.extensions/kube-flannel-ds-arm created
daemonset.extensions/kube-flannel-ds-ppc64le created
daemonset.extensions/kube-flannel-ds-s390x created

# show state (OK if STATUS = Ready)

kubectl get nodes

dlp.srv.world   Ready    master   3m18s   v1.12.1

# show state (OK if all are Running)

kubectl get pods --all-namespaces

NAMESPACE     NAME                                    READY   STATUS    RESTARTS   AGE
kube-system   coredns-576cbf47c7-fjzbw                1/1     Running   0          3m12s
kube-system   coredns-576cbf47c7-tvh2r                1/1     Running   0          3m12s
kube-system   etcd-dlp.srv.world                      1/1     Running   0          2m19s
kube-system   kube-apiserver-dlp.srv.world            1/1     Running   0          2m19s
kube-system   kube-controller-manager-dlp.srv.world   1/1     Running   0          2m24s
kube-system   kube-flannel-ds-amd64-glkls             1/1     Running   0          55s
kube-system   kube-proxy-4lsdk                        1/1     Running   0          3m12s
kube-system   kube-scheduler-dlp.srv.world            1/1     Running   0          2m25s
Matched Content