(K8s) Kubernetes lab 101 Building single master cluster
Step 0 : Create docker hub account. https://hub.docker.com
Step 1 : Open Play with Kubernetes login with your docker hub account.
Step 2 : Click on start
Step 3 : It will start a 4 hr session, click on + ADD NEW INSTANCE
Step 4 : Click in terminal.
Step 5 : kubeadm init --apiserver-advertise-address $(hostname -i) --pod-network-cidr 10.5.0.0/16
use kudeadm to initialize kubernetes cluster
--apiserver-advertise-address is to advertise api server address
--pod-network-cidr is to provide subnet used for pod network
this command will pull container images required for kubernetes cluster and may take sometime
you may load image proactively by using kubeadm config images pull
you may also select specific version with --kubernetes-version
take note of output similar to below, it will be required for other nodes to join cluster
kubeadm join XXXXXXX — token XXXXXX — discovery-token-ca-cert-hash sha256:XXXXXXXXX
Step 6 : kubectl get nodes
use above command to display nodes in k8s cluster
there will be only master node with status NotReady
node is NotReady as there is no networking add-on
Step 7 : kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml
this command will get yaml file from github
install network add-on to cluster
Step 8 : kubectl get nodes
node will be in ready state after few minutes
Step 9 : click on + ADD NEW INSTANCE
add new instance
Step 10 : enter kubeadm join command in new node terminal
kubeadm join XXXXXXX — token XXXXXX — discovery-token-ca-cert-hash sha256:XXXXXXXXX
above command will join new node to cluster
this command will be different for you
you will get this from step 5
Step 11 : kubectl get nodes
you will see two nodes
one master and second with none role
second node might be NotReady at first
it could take few minutes to get Ready
Step 12 : click on + ADD NEW INSTANCE
add new instance
Step 13 : enter kubeadm join command in new node terminal
kubeadm join XXXXXXX — token XXXXXX — discovery-token-ca-cert-hash sha256:XXXXXXXXX
copy above command will join new node to cluster
this command will be different for you
you will get this from step 5
Step 14 : kubectl get nodes
you will see three nodes
one master two with none role
third node might be NotReady at first
it could take few minutes to get Ready