Tuesday, September 25, 2018

Kubernetes in an Ubuntu VM

Installing Kubernetes on Ubuntu
This is not all my own work in any way - but relies on previous materials.

I started with an Ubuntu VM running 4GB ram and 3 cores with 80GB disk

The Kubelet service will not start (apparently) unless swap has been disabled on any Kube master or node. I'm sure there's a good reason and it may be overall performance of a large subcapacity system
Sudo swapoff -a  and comment out swap in /etc/fstabwith a #

tar -zxvf helm-v2.8.2-linux-amd64.tar.gz
chmod +x linux-amd64/helm
sudo mv spt-get update && sudo apt-get install -y apt-transport-https
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo 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 (edit this file with vi and add 'deb http://apt.kubernetes.io/ kubernetes-xenial main')
sudo apt-get update
sudo apt-get install -y kubelet=1.9.6-00 kubeadm=1.9.6-00 kubectl=1.9.6-00 kuberneters-cni
sudo kubeadm init --pod-network-cidr 'your v4 IP address'/16
once this completes...
mkdir -p ~/.kube
sudo cp -f /etc/kubernetes/admin.conf ~/.kube
sudo chmod 755 -R ~/.kube
kubectl get po -n kube-system (0/3 dns pods will be running)

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 (3/3 dns pods should be running - may take a little while - in a VM where they would not start I tracked this down to insufficient CPU cores assigned to the VM by using 'kubectl describe po kube-dns-xxxxxxxxxz-xxxxx -n kube-system')
kubectl taint nodes --all node-role.kuberneters.io/master (allows this master node to run workloads - however I had difficulty getting this to complete in a way that looked successful)

The result is Kubernetes is up and running.




 

No comments: