Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[Ubuntu] Kubernetes guide for Master and Nodes installation

WilliamWilliam Moderator
edited December 2018 in Linux Applications

In this guide we will be installing Kubernetes Master server, together with installing Kubernetes Node servers and connecting them to the Master server. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications from a Master server instance.

0. Requirements:

  • KVM Linux server running on Ubuntu 16.04 OS.

1. Preparing your VPS for installation of Kubernetes:

Both, Master server and Node servers has to be prepared with required packages. Firstly, update your package list (commands will be initiated as root. If done by other user, use "sudo"):
apt-get update
Afterwards, when the packages list are updates, proceed with installation of apt-transport-https package:
apt-get install -y apt-transport-https
Afterwards, install Docker that will be the container system for Kubernetes:
apt install -y
When the installation will be completed, start and enable Docker service:
systemctl start docker && systemctl enable docker

2. Installation of Kubernetes:

Since the required packages and other instances have been installed, we can now proceed with installation of Kubernetes server. Firstly let's download and add the key for Kubernetes Installation:
Now let's create a file with your text editor (We will be using "nano" for this one, however you can use any other):
nano /etc/apt/sources.list.d/kubernetes.list
In the file enter the following line, save and close it:
deb kubernetes-xenial main
Now, let's install the Kubernetes with required packets:
apt-get update && apt-get install -y kubelet kubeadm kubectl kubernetes-cni

3. Setting up Kubernetes Master server:

The following command will setup the configuration files and boot up the whole Master server.
sudo kubeadm init
!!!Important!!!, do not close terminal after this command is completed, since you will receive your unique token key, which is required for Node server to connect. The setup will take about couple of minutes. Following command should be used as additional user with sudo rights:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
The formed token with connection command should look like this:
kubeadm join <master node IP>:6443 --token i5s534.38o26swycl0gd0gr --discovery-token-ca-cert-hash sha256:4b4c8d9652e925dffe0f28c73984c27d821cd998f63525dd45378a762517dea3

The token should be valid only for 24 hours. If you would like to add other nodes to your cluster after some time, new token can be generated with using
kubeadm token generate

4. Connecting Node server to Master:

This is the easiest part. When you will have your Master server running, for your Node servers, repeat the "1. Preparing your VPS for installation of Kubernetes" and "2. Installation of Kubernetes" parts of this guide for general installation of Kubernetes. When the Node server will have Kubernetes installed, use the command that was generated for you at the end of Master node configuration:
kubeadm join <master node IP>:6443 --token 
i5s534.38o26swycl0gd0gr --discovery-token-ca-cert-hash 
Instead of master node IP server will have generated your Master server's IP address so no additional adjustments will be required. If you will use your separately generated token, you should adjust the --token code to the one that will be generated for you.

5. Finishing up the setup:

To check if everything was correct, from the Master node initiate the command
kubectl get nodes
Command results should look similar to:
NAME                     STATUS    ROLES     AGE       VERSION
Node.hostname   Ready     <none>    1d        v1.11.2
Master.hostname   Ready     master    1d        v1.11.2
You can now set services for you cluster or scale it's size by adding additional servers to the cluster in the same way as you have added the first node. For more information on cluster management, loads of useful information is provided in the Kubernetes Documentation. Good luck with your cluster!



  • WilliamWilliam Moderator
    edited December 2018
    Since Docker have released a new version of Docker 18.09 which is already supported by Kubernetes and recognized by kubeadm, some external dependencies might still require Docker 18.06 to be used. For this you can choose to form the installation not with newest Docker version, but specifically with 18.06 version. For any updates on the supported versioning, information is constantly updated on Kubernetes release notes page.
Sign In or Register to comment.


Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch