Kubernetes Options for Installation
- Bare-Metal Installations:
- Start from OS
- Install Every Component
- K8s the hard way
- Other Managed Installations:
- Start from OS
- You need not install every component
- Popular options
- minikube (developer)
- micro k8s (developer)
- kube-admin
- kops
- Cloud-Provider Installations:
- You will get k8s as a service.
- You need to take care of nodes. Masters generally will be managed by cloud-providers
- Popular options:
- GKE
- AKS
- EKS Refer Here for complete list of providers
Installation Steps
-
Setup Details:
- Four ubuntu 16.04 machines
- One will be master
- other 3 will nodes
- Ensure all the four machines can communicate with each other
- We will be kubeadm and we will follow official k8s documentation over here
-
Login into all nodes, become root user and install docker using steps from here
-
Install the kubelet, kubeadm and kubctl on all nodes from here
-
Necessary software’s are present on your nodes
-
we need to create k8s cluster. For creating cluster. Refer documentation from here
-
Login into master node as a root user
kubeadm init
- If kubeadm is able to install succesfully, it gives some info at the end which looks like
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:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.31.29.1:6443 --token o38veh.5g6zhgfaafg5zzk3 \
--discovery-token-ca-cert-hash sha256:bd735d51e2beceaa9c4aba6f32ef6d91dabdfb51d93a9f8bcb41c51e9c5f45d9
- Pod networking is enabled only after you install pod network.
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
- Now login into nodes as a root user and execute kubeadm join command with necessary arguments which you have copied.
Basic Commands to execute after kubeadm installation in master
kubctl get nodes
kubectl get nodes -w # watch the output changes
kubectl get nodes -o wide # more info
kubectl get pods # List all the pods you created
kubectl get pods --all-namespaces # Lists all the pods in the cluster irrespective of who created
Can I use this setup in Enterprise?
NO Why?? Problem with current setup is we have single node for master. To use it in staging/prod environments, master needs to be Highly available.
For that refer below * options * steps
What is that I create in Kubernetes
Workers
- Pod:
- atomic unit of work in k8s
Controllers
- Control the pods
- Eg: Deployment, Statefulset, Daemonsets