Kubeadm tutorial

TAGS: kubernetes calico kubeadm docker deploy

How to deploy k8s with calico net on 2 virtualbox vm’s via kubeadm

  1. Create 2 ubuntu VB vms
    +4GB ram
    +50GB dynamic storage
    2 adapters (nat + virtualbox host network)
    ubuntu 16.04 adapter

  2. Install os

  3. Adapter settings
    Virtualboxhostnetwork:
    cat /etc/network/interfaces.d/enp0s9 auto enp0s9 iface enp0s9 inet static address 172.28.33.46 — IMPORTNAT — ONLY NOT THE 192.168. or 10.0…. netmask 255.255.255.0 gateway 172.28.33.1 up route del gw 172.28.33.1
    Nat: auto enp0s3 iface enp0s3 inet dhcp up route add default gw 10.0.2.2

  4. Update ssh config — permit rootlogin && service ssh restart

  5. Ssh into machines

  6. Install kubeadm
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add — cat </etc/apt/sources.list.d/docker.list deb https://download.docker.com/linux/$(lsb_release -si | tr ‘[:upper:]’ ‘[:lower:]’) $(lsb_release -cs) stable EOF apt install curl apt-transport-https kubeadm ebtables

  7. Install Docker 1.12
    curl https://releases.rancher.com/install-docker/1.12.sh | sh

  8. Edit /etc/hosts — insert machines ip/names

  9. Generate ssh keys and copy them to all machines
    ssh-keygen ; ssh-copy-id root@machine{1,2}

  10. Disable swap
    vim /etc/fstab — comment swap entry swapoff -a; reboot

  11. Start kubeadm master
    Master VM
    kubeadm init --apiserver-advertise-address $MASTERVBHOSTNETIP --pod-network-cidr=192.168.0.0/16 --service-cidr 10.96.0.0/12
    If there is any problem — run
    kubeadm reset

  12. Copy kube config through the nodes
    mkdir ~/.kube; cp /etc/kuebernetes/admin.conf ~/.kube/config; scp -r ~/.kube/config node2:~/

  13. Creating calico virtual network in k8s kubectl apply -f http://docs.projectcalico.org/v2.4/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml

  14. Join slave node to master run on slave (you will need information from step 11 - token,sha256
    kubeadm join --token $roken --discovery-token-ca-cert-hash $sha256

  15. Enable compute resources on master node kubectl taint nodes —all node-role.kubernetes.io/master
    tells our cluster tha we can ran some pods on master node

  16. Check kubectl get nodes
    if all okey — lets try out our cluster

  17. Creating test app kubectl create namespace sock-shop kubectl apply -n sock-shop -f "https://github.com/microservices-demo/microservices-demo/blob/master/deploy/kubernetes/complete-demo.yaml?raw=true"
  18. Check kubectl get po -n sock-shop
Written on October 11, 2017

Archive

linux openstack kubernetes gluster ceph ansible docker systemctl python openshift log centos sed registry kolla kibana keepalived elasticsearch deploy cloud-init auth HA zabbix vsphere vmware venv tools swift ssl ssh scm ruby rsyslog rhel rbac rabbitmq prometheus postgres policy pgpool2 patrole pacemaker ntp nfs net mq monitoring mongo mbr lvm logstash kubespray kubeadm kolla-ansible jenkins jekyII java ironic helm heketi harbor grub github ganesha fluentd fluent-bit fio drbd diskimage-builder devstack debug deb db cisco cicd ceph-ansible calico build bitbucket benchmarking apparmor api NUMA Linux Golang Go ELK 3par