Installation

Local cluster on Windows with minikube

  • disable Hyper-V in windows if you have it on (Turn Windows features on or off)
  • VT-x/AMD-v virtualization must be enabled in BIOS
  • VirtualBox should be installed
  • download https://github.com/kubernetes/minikube/releases and put to c:\ (or some env variable custumization will be required)!
  • https://github.com/eirslett/kubectl-windows/releases also put to c:\
.\minikube-windows-amd64.exe get-k8s-versions
.\minikube-windows-amd64.exe start --kubernetes-version="v1.8.0" --vm-driver="virtualbox" --alsologtostderr

Info:

minikube-windows-amd64.exe status

Dashboard:

minikube-windows-amd64.exe dashboard

To stop (stops virtualbox instances):

.\minikube-windows-amd64.exe stop

accessing cluster

If use local kubectl it will automatically detect cluster and eventualy remember access params in .kube:

In another case (e.g. from WSL or remote machine),

Show cluster info on local machine:

kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority: C:\Users\x\.minikube\ca.crt
    server: https://192.168.99.100:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: C:\Users\x\.minikube\client.crt
    client-key: C:\Users\x\.minikube\client.key

To connect from other machine you can edit config on that machine and put config showed on original machine

vim ~/.kube/config

File paths in config are related from .kube folder, so copy certs to e.g. .kube/.minikube. Then use-context:

kubectl config use-context minikube

working with cluster

List nodes:

kubectl get nodes
kubectl run hello-nginx --image=nginx --port=80 

Expose:

kubectl expose deployment hello-nginx --type=NodePort

URL be shown:

minikube-windows-amd64.exe service --url=true hello-nginx

e.g. http://192.168.99.100:31943

on bare cluster machines

Check each machine has unique mac and product_uuid:

ip link
sudo cat /sys/class/dmi/id/product_uuid

daemon.json ensures that cgroup driver used by kubelet is same as the one used by Docker (ore kubelet --cgroup-driver=cgroupfs)

sudo -i
apt-get update
apt-get install -y docker.io
cat << EOF > /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
EOF

kubelet version should be <= API server version

kebernetes-xenial for Ubuntu 16.04.3 LTS

apt-get update && apt-get install -y apt-transport-https
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 http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl

Starting master:

kubeadm init

Then joing by last command


LINKS:
1. https://rominirani.com/tutorial-getting-started-with-kubernetes-on-your-windows-laptop-with-minikube-3269b54a226