Huge thanks to Ani for showing me this
nano /etc/hostname # Write your machine's IP
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
apt-get install \
ca-certificates \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
apt-get install docker-ce=18.06.1~ce~3-0~debian
swapoff -a
nano /etc/fstab # Remove swap entry
IP_MASTER=<your-master-ip>
TOKEN=`kubeadm token generate`
kubeadm init \
--pod-network-cidr 10.244.0.0/16 \
--token $TOKEN \
--skip-token-print \
--apiserver-advertise-address $IP_MASTER
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubeadm token create --print-join-command
kubeadm join <your-master-ip>:6443 \
--token qv2auc.yppv796dht7q4r1w \
--discovery-token-ca-cert-hash \
sha256:9df81aef766ca7d93818bfcf24c00cb1a3413bd148357cce6db7853114a966bd
scp root@<your-master-ip>:/home/<your-kube-user>/.kube/config ~/.kube/config
kubectl get nodes
kubectl get pods --all-namespaces
Install flannel
(Network plugin)
kubectl apply -f \
https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl get pods --all-namespaces
Install dashboard
app (this also creates a role for the dashboard but does not bind it)
kubectl apply -f \
https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
kubectl get pods --all-namespaces
kubectl create clusterrolebinding \
kubernetes-dashboard \
--clusterrole=cluster-admin \
--serviceaccount=kube-system:kubernetes-dashboard
kubectl create namespace staging
kubectl get namespaces # List 'em
kubectl proxy
kubectl -n kube-system describe secret \
$(kubectl -n kube-system get secrets | \
grep kubernetes-dashboard | \
cut -f1 -d ' ') | \
grep -E '^token' | \
cut -f2 -d':' | tr -d '\t'
- StorageClass
- Deploy a custom application