Kubernetes Container Orchestration
Overview
Setup
Note : I am running Kubernets on my Windows 10 desktop utilizing Minikube. Most of the command seen here will either work for both or be specific to MiniKube. I will add production commands as I either run across them or learn them.
I followed this walkthru to setup Kubernetes on my Windows 10 server.
- Download MiniKube - Why?
- Download Kubectl.exe - MiniKube uses. - Why?
- Start the MiniKube and allow it to create a VM for you - Defaults to Virtualbox will need to specify Hyperv - minikube start --vm-driver 'hyperv' --v=7 --alsologtostderr
- Configuration Settings are in users profile under .MiniKube
Production Setup
https://kubernetes.io/docs/setup/independent/install-kubeadm/
Kubernetes needs a master installed on a Linux VM to control the nodes and containers.
- Create VM with Ubuntu
- Best Practices for Linux on Hyper-v https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/best-practices-for-running-linux-on-hyper-v
- Install Docker
- Install Kubeadm, kubelet and kubectl
- sudo apt-get update
- sudo apt-get install -y apt-transport-https curl
- sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list > /dev/null
- this command is different than on the web because we need to run the redirection as sudo and the > operator doesn't allow that. So the TEE command is used.
- deb http://apt.kubernetes.io/ kubernetes-xenial main
- EOF
- sudo apt-get update
- sudo apt-get install -y kubelet kubeadm kubectl
- sudo apt-mark hold kubelet kubeadm kubectl
- Initailize the master
Dashboard
The dashboard is an overview of applications running on your Kubernetes cluster. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster itself along with its attendant resources
Enter the following to open the dashboard
MiniKube Dashboard
Troubleshooting
Error : You must be logged in to the server (the server has asked for the client to provide credentials)
Kubectl needs to be connected to the correct Kubernetes cluster. This is done via a config file that sets the correct context for the cluster. If this is not set correctly you can get the above error. Behind the scenes in your %HOMEPATH%\.kube directory, there is a config file that contains information about your Kubernetes cluster and the details for connecting to your various clusters is present over there.
To set the context
kubectl config use-context minikube