Kubernetes Installation( kubeadm =Non Production)
Kubernetes installation(Kubeadm for non production)
AWS (t2.micro) pricing details:
low-cost-burstable-ec2-instances
https://aws.amazon.com/blogs/aws/low-cost-burstable-ec2-instances/
- Ensure you have more than one linux with following flavors
- Ensure following ports are open
- Install docker runtime on master & all nodes by following here
- Install kubeadm components on master & all nodes by following here
- Login into master, become a root user (sudo -i)
- execute
kubeadm init root@ip-172-31-7-224:~# kubeadm init
[init] Using Kubernetes version: v1.13.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 connectionTo 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:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 172.31.7.224:6443 --token 1fz0wn.t0um5nfzqkpmkbc2 --discovery-token-ca-cert-hash sha256:cca66babbd28dd63d3cabc4312d85266db0b061dd6c877e52cfb206a6a435a6f
- make the note of kubeadm join command
- now become the non root user (exit) and create kubeconfig
ubuntu@ip-172-31-7-224:~$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
ubuntu@ip-172-31-7-224:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
- install pod network on master
serviceaccount/weave-net created
clusterrole.rbac.authorization.k8s.io/weave-net created
clusterrolebinding.rbac.authorization.k8s.io/weave-net created
role.rbac.authorization.k8s.io/weave-net created
rolebinding.rbac.authorization.k8s.io/weave-net created
daemonset.extensions/weave-net created
=> Then check the nodes status before n/w join and after:(Status will become ready after pods network)
Before:
ubuntu@ip-172-31-7-224:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-4-210 NotReady <none> 46s v1.13.3
ip-172-31-7-224 NotReady master 21m v1.13.3
After:
ubuntu@ip-172-31-7-224:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-4-210 Ready <none> 100s v1.13.3
ip-172-31-7-224 Ready master 22m v1.13.3
- log in to the nodes become root user & execute kubeadm join command which you have copied
[preflight] Running pre-flight checks
[discovery] Trying to connect to API Server "172.31.7.224:6443"
[discovery] Created cluster-info discovery client, requesting info from "https://172.31.7.224:6443"
[discovery] Requesting info from "https://172.31.7.224:6443" again to validate TLS against the pinned public key
[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "172.31.7.224:6443"
[discovery] Successfully established connection with API Server "172.31.7.224:6443"
[join] Reading configuration from the cluster...
[join] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet] Downloading configuration for the kubelet from the "kubelet-config-1.13" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Activating the kubelet service
[tlsbootstrap] Waiting for the kubelet to perform the TLS Bootstrap...
[patchnode] Uploading the CRI Socket information "/var/run/dockershim.sock" to the Node API object "ip-172-31-4-210" as an annotation
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the master to see this node join the cluster.
root@ip-172-31-4-210:~#
Comments
Post a Comment