Kubernetes is the new mind breaking technology of Google and it is very close to Docker. In fact you need docker to run Kubernetes as well. So you can say that Kubernetes is based on Docker. So let's get it going. We will use 3 machines:
To configure our kubernetes, we have to install the following:
Furhtermore, Kubernetes have various objects, but let's examine the main ones:
To install the packages we have to:
So let's get going :)
The repo is configured very easy using the following script:
Repo Config
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
Please bare in mind, this is for Ubuntu Xenial 64. If you have different distribution please adjust….the last entry :)
vagrant@node-1:~$ sudo su - root@node-1:~# apt-get update && apt-get install -y apt-transport-https 0% [Working] Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB] Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB] Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [850 kB] Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB] Get:7 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [489 kB] Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [200 kB] Get:9 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [5,728 B] Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,708 B] Get:11 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB] Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB] Get:13 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB] Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1,129 kB] Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [796 kB] Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [333 kB] Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.8 kB] Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,468 B] Get:19 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7,280 B] Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [4,456 B] Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8,064 B] Get:22 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4,328 B] Fetched 16.3 MB in 12s (1,318 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done apt-transport-https is already the newest version (1.2.32). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@node-1:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - OK root@node-1:~# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list > deb http://apt.kubernetes.io/ kubernetes-xenial main > EOF root@node-1:~# apt-get update Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease Get:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,993 B] Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [35.3 kB] Fetched 44.3 kB in 2s (20.6 kB/s) Reading package lists... Done root@node-1:~#
Please run this command on all 3 machines.
So let's install the packages now:
Install packages
root@k8s-master:~# apt-get install -y docker.io kubeadm kubectl kubelet kubernetes-cni Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bridge-utils cgroupfs-mount conntrack containerd cri-tools ebtables pigz runc socat ubuntu-fan Suggested packages: mountall aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils The following NEW packages will be installed: bridge-utils cgroupfs-mount conntrack containerd cri-tools docker.io ebtables kubeadm kubectl kubelet kubernetes-cni pigz runc socat ubuntu-fan 0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded. Need to get 104 MB of archives. After this operation, 532 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 pigz amd64 2.3.1-2 [61.1 kB] Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 bridge-utils amd64 1.5-9ubuntu1 [28.6 kB] **************************************************************************************************************
Please execute that on all 3 machines