Ondrej Sika (sika.io) | ondrej@sika.io
Ondrej Sika <ondrej@ondrejsika.com>
https://github.com/ondrejsika/bare-metal-kubernetes
- Czech Republic - ondrej-sika.cz/skoleni/kubernetes
- Europe - ondrej-sika.com/training/kubernetes
- Kubernetes Training - ondrejsika/kubernetes-training (on Github)
Write me mail to ondrej@sika.io
curl -fsSL https://ins.oxs.cz/docker.sh | sudo sh
curl -fsSL https://ins.oxs.cz/kubernetes.sh | sudo sh
sudo apt install nfs-common
Kubernetes doesn't run if you have swap on. You can disable it using:
swapoff -a
Now you can setup master
kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You can also disable swap, if it's on:
swapoff -a
kubeadm join <ip>:6443 --token <token> --discovery-token-ca-cert-hash <ca-hash>
If you want run cluster with just one server (master only), you have to allow to run containers on master, which is not recommended.
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
or
kubectl apply -f kube-flannel.yml
kubectl get nodes
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
or
kubectl apply -f kubernetes-dashboard.yaml
kubectl apply -f https://raw.githubusercontent.com/ondrejsika/kubernetes-install-bare-metal/master/dashboard-user.yml
kubectl apply -f dashboard-user.yml
kubectl -n kube-system describe serviceaccounts admin-user
kubectl -n kube-system describe secret <admin-user-token>
Or in one line
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t'
kubectl proxy
I've prepared Ingress Controllet configuration, you can apply it by:
kubectl apply -f https://raw.githubusercontent.com/ondrejsika/kubernetes-ingress-traefik/master/ingress-traefik.yml
or browse in own repository ondrejsika/kubernetes-ingress-traefik
Docs https://github.com/helm/helm/blob/master/docs/install.md
Or oneliner for Linux:
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
Or on Windows:
choco install kubernetes-helm
helm install nfs-client-provisioner stable/nfs-client-provisioner --set nfs.server=<nfs-server> --set nfs.path=<exported-path>
For example:
helm install nfs-client-provisioner stable/nfs-client-provisioner --set nfs.server=nfs.sikademo.com --set nfs.path=/nfs
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'