====== Kubernetes ====== ===== Installation ===== Add the Repository,install "kubelet" + "kubeadm" + "kubectl" and set the updates on hold curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \ sudo apt-get update -q && \ sudo apt-get install -qy kubelet kubeadm kubectl apt-mark hold kubelet kubeadm kubectl ===== Configuration ===== ==== master ==== Pull images used by kubeadm kubeadm config images pull Set up the ip configuration, the "apiserver-advertise-address" has to be your management ip kubeadm init --apiserver-advertise-address=10.0.0.2 --pod-network-cidr=192.168.0.0/16 #kubeadm init --pod-network-cidr=192.168.0.0/16 You may run into the following warnings and errors [init] Using Kubernetes version: v1.16.2 [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.4. Latest validated version: 18.09 error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR Swap]: running with swap on is not supported. Please disable swap [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher To fix the error, disable swap swapoff -a #should be 0 now free -m total used free shared buff/cache available Mem: xxxx xxx xxxx xxx xxxx xxxx Swap: 0 0 0 Execute the ip configuration again, which should now be possible. If the initialization was successful, create a new user. useradd -s /bin/bash -m kubernetes su - kubernetes mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config Next you need to deploy a pod network.\\ Find some here: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network I use calico, which can be deployed via kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml ==== Dashboard ==== Find the dashboard for your kubernetes version here:\\ [[https://github.com/kubernetes/dashboard/releases]] You can see your version via kubeadm version ===== Commands ===== ^ Command ^ Function ^ | kubectl get pods --all-namespaces | show pods | | kubeadm reset | reverts changes made via "kubeadm init" and "kubeadm join" | ===== Troubleshooting ===== ==== Placeholder ==== __Reason:__ \\ \\ __Fix:__ \\ \\ ===== Offene Fragen... ===== * cgroup driver?! [[https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node]] Please mind, that you only have to do that if the cgroup driver of your CRI is not cgroupfs, because that is the default value in the kubelet already. ABER [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ Reason why https://github.com/kubernetes/kubeadm/issues/1394#issuecomment-462878219 * validated version of docker? [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.4. Latest validated version: 18.09 * management ip https://github.com/kubernetes/kubernetes/issues/33618 kubectl edit deployment kubernetes-dashboard -n kube-system NAMESPACE anders!!! kein ttl im dashboard