## page was renamed from linux/kubernetes #format wiki #language en = Kubernetes Docker cluster manager = * [[Azure/Kubernetes]] * Notes: https://gitlab.com/snippets/1813194 * Interacting with running pods - https://kubernetes.io/docs/reference/kubectl/cheatsheet/#interacting-with-running-pods == 2022 k3s / k3d == * [[k8s/k3s/k3d]] * Simplest local k8s install, can run cluster as docker containers to simulate multiple nodes, even works on pi == 201903 minikube == * Install using curl * open host fw for port 8443 admint to vm * sudo minikube start --vm-driver=kvm2 * helm == 201810 microk8s snap https://github.com/ubuntu/microk8s == * ubuntu laptop - /!\ not a big snap fan - {{{ sudo snap install microk8s --classic microk8s.kubectl get all --all-namespaces microk8s.kubectl get no microk8s.enable dns dashboard watch microk8s.kubectl get all --all sudo snap alias microk8s.kubectl kubectl }}} == 2019 Load tls certificate into kubernetes secrets == * check the validity of certificate by {{{ openssl x509 -in fullchain.pem -text -noout | grep -A 2 'Validity' }}} * Load cert with kubectl {{{ kubectl create secret tls wildcard-mine-tls --key privkey.pem --cert fullchain.pem }}} == 201804 == * minikube 1. Install minikube {{{ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ }}} 1. for kvm add kvm2 driver https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver {{{ curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 && chmod +x docker-machine-driver-kvm2 && sudo mv docker-machine-driver-kvm2 /usr/local/bin/ }}} 1. kubectl to manage things. {{{ curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ }}} 1. ensure current user belongs to libvirtd and kvm installed {{{ sudo apt install libvirt-bin qemu-kvm }}} 1. ensure default kvm network up {{{ virsh net-autostart default virsh net-start default }}} 1. start {{{ minikube start --vm-driver=kvm2 }}} 1. verify that minikube is running {{{ virsh list }}} 1. Test with examples from https://kubernetes.io/docs/getting-started-guides/minikube/#installation == 201704 == * Add google apt-key {{{ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - }}} * Add to apt sources.list {{{ cat < /etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main EOF }}} {{{ echo "deb http://apt.kubernetes.io/ kubernetes-trusty main" >> /etc/apt/sources.list.d/kubernetes.list }}} * install packages {{{ sudo apt-get install -y docker.io kubelet kubeadm kubectl kubernetes-cni sudo systemctl enable docker.service }}} * Got a error for docker certificate, had to delete it to get the docker deamon to start * error {{{ level=fatal msg="Error creating cluster component ...Bla...Bla...Bla... certificate expired. }}} * fix {{{ rm /var/lib/docker/swarm/certificates/swarm-node.* }}} * setup kubernetes (k8s) master node {{{ sudo kubeadm init }}} * error in pre-flight checks {{{ DOCKER_GRAPH_DRIVER: btrfs }}} * fix, edit the /etc/docker/deamon.conf and add devicemapper option, remember "," after options. {{{ "storage-driver": "devicemapper", }}} * Success for kubeadm init {{{ Your Kubernetes master has initialized successfully! To start using your cluster, you need to run (as a regular user): sudo cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: http://kubernetes.io/docs/admin/addons/ You can now join any number of machines by running the following on each node as root: kubeadm join --token 030871.9354eb2226c8b23b 10.0.2.15:6443 }}} == Ubuntu 14.04 trusy - does not have a full set of kubernetes packages == * Install from source 1. sudo apt install git -y 1. git clone https://github.com/kubernetes/kubernetes.git 1. cd kubernetes 1. ./build/run.sh make cross ... ---- CategoryK8sKubernetes CategoryK8sKubernetes