Bare-metal
Install a cluster using Kubeadm on bare-metal servers
Install docker
Check which Docker version Kubernetes supports: https://kubernetes.io/docs/setup/cri/#docker
By the time of this writing, the latest supported docker version is 18.06.2.
Install dependencies:
Add the repo:
Install Docker:
Replace 18.06.2 with the latest supported docker version.
Setup firewall
Master
Nodes
References
https://kubernetes.io/docs/setup/independent/install-kubeadm/
Install kubelet, kubeadm and kubectl
Init cluster
Make sure you server's host name is configured (avoid changing the host name after the cluster is created).
Copy and save the kubeadm join
command.
Configure your user to run kubectl:
Deploy Weave Net:
By the time of this writing, Kubeadm has an issue. Coredns will remaing "pending" until you deploy Weave Net: https://github.com/kubernetes/kubeadm/issues/980
Confirm that all of the pods are running with the following command.
Wait until each pod has the STATUS of Running.
Confirm that master node is ready:
If you want to deploy Calico instead, check the latest documentation: https://docs.projectcalico.org/v3.5/getting-started/kubernetes/
References
https://dzone.com/articles/deploying-kubernetes-dashboard-to-a-kubeadm-create https://zihao.me/post/creating-a-kubernetes-cluster-from-scratch-with-kubeadm/ https://chrislovecnm.com/kubernetes/cni/choosing-a-cni-provider/ https://docs.projectcalico.org/v3.5/getting-started/kubernetes/
Dashboard
Deploy the dashboard:
In your workstation...
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
Create dashboard user: https://devops-buzz.gitbook.io/public/kubernetes/dashboard#create-user
Join node
Install kubelet, kubeadm and kubectl.
Setup Docker cgroupdriver systemd
Check docker systemd service config file:
Sample output:
Edit the file:
Add --exec-opt native.cgroupdriver=systemd
to the ExecStart
option:
Restart daemon:
Add node to the cluster
The worker node must have exactly the same master versions of the following packages: kubelet, kubeadm, kubectl, kubernetes-cni.
Reference here.
Install packages, for example:
Hold packages versions:
Make sure the master node firewall allows the new node to access it on port 6443.
Make sure you server's host name is configured (avoid changing the host name after).
Run the joint command:
Use your cluster join command.
If by any chance you need to run the join command more than one time and you the certificate FileAvailable--etc-kubernetes-pki-ca.crt
, run this command before:
You should see this output:
Go to your master server and label the new node:
Remove node
List your current nodes:
Output example:
Let's suppose you want to remove the node ip-172-31-9-145
:
Check node status:
Output example:
Then, on the node being removed, reset all kubeadm installed state::
The reset process does not reset or clean up iptables rules or IPVS tables. If you wish to reset iptables, you must do so manually:
If you want to reset the IPVS tables, you must run the following command:
Kubeadm over VPN
Last updated