This guide shows how to install Kubernetes on a bare metal device.
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo touch /etc/apt/sources.list.d/kubernetes.list
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install kubelet kubeadm kubectl jq
sudo swapoff -a
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
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:
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 10.39.27.222:6443 --token ajgrb7.k2dt4gfbmimux58s --discovery-token-ca-cert-hash sha256:84df1455ef7ae1dcc38dc9750754abe63b9360ca90e5ee88008240c458d43aeb
Make sure to run the commands in the output!
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml
$ kubectl get po -n kube-system
NAME READY STATUS RESTARTS AGE
calico-node-7jcn9 2/2 Running 0 43s
coredns-78fcdf6894-khnzw 1/1 Running 0 5m
coredns-78fcdf6894-qt2kk 1/1 Running 0 5m
etcd-sko-demo-wbr1 1/1 Running 0 5m
kube-apiserver-sko-demo-wbr1 1/1 Running 0 5m
kube-controller-manager-sko-demo-wbr1 1/1 Running 0 5m
kube-proxy-4fz5q 1/1 Running 0 5m
kube-scheduler-sko-demo-wbr1 1/1 Running 0 4m
For single node clusters, untaint the master node so that regular workloads can be scheduled.
kubectl taint node <node-name> node-role.kubernetes.io/master-
For more info visit https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#join-nodes
All Kubernetes components should automatically come back up. If not, make sure swap is still disabled and that the kubelet system service is running.
systemctl enable kubelet && systemctl start kubelet