This article has for goal to demonstrate you how to create a Kubenetes (bare metal) single master cluster with the kubeadm tool on a remote Debian 9 server.



  • 2 GBs minimum per machine.
  • 2 CPUs minimum.
  • Full network connectivity between all machines in the cluster.
  • Unique hostname, MAC address, and product_uuid for every node.
  • Swap disabled.
  • Certain ports have to be open on your machines:Port details for Master node
    Protocol Direction Port Range Purpose
    TCP Inbound 6443* Kubernetes API server
    TCP Inbound 2379-2380 etcd server client API
    TCP Inbound 10250 Kubelet API
    TCP Inbound 10251 kube-scheduler
    TCP Inbound 10252 kube-controller-manager
    TCP Inbound 10255 Read-only Kubelet API

    Port details for Worker node

    Protocol Direction Port Range Purpose
    TCP Inbound 10250 Kubelet API
    TCP Inbound 10255 Read-only Kubelet API
    TCP Inbound 30000-32767 NodePort Services**



You have to know you can get away with a single host for testing but it’s highly recommended to have at least a single master and two worker nodes in your cluster.

Now, run the followings commands on each nodes as root (Gist). The following script install everything you need for running Kubernetes on your machine(s):

Linux utils

  • apt-transport-https
  • ca-certificates
  • curl
  • software-properties-common

Docker + Kubernetes

  • docker-ce (docker community edition)
  • kubelet (the component that runs on all of the machines in your cluster and does things like starting pods and containers.)
  • kubeadm (to bootstrap the cluster, could be only installed in your master)
  • kubectl (to control the cluster)



Disable swap

Since Kubernetes 1.8, you need to disable swap on each servers.



Support for swap is non-trivial. Guaranteed pods should never require swap. Burstable pods should have their requests met without requiring swap. BestEffort pods have no guarantee. The kubelet right now lacks the smarts to provide the right amount of predictable behavior here across pods. (@derekwaynecarr)



Create the cluster

At this step, connect you from ssh to your remote master server.


As root, initialize your cluster with kubeadm.


You should have a similar output like that:


At this moment, your kubernetes cluster is created, but to start using it, you need to run the following steps (as a regular user / not root):



To not every time adding –kube-config argument to your kubectl command, example


You can create an environment variable to say to Kubernetes to use this config file as default.


Now, you can use kubectl without –kube-config argument.


Join the cluster (optional for this tutorial)

If you have workers, you can easily join the cluster with the command generated by the previous kubeadm command.


Create a network (optional for this tutorial)

There are many network providers available for Kubernetes, but none are included by default. Weave Net (created by Weaveworks) is one of the most popular providers in the Kubernetes community. One of its many benefits is that it works directly without any configuration.


Apply your first chart

Before applying the kubernetes-dashboard chart, we check the cluster and nodes status.


Everything is ok, we can apply the recommended kubernetes-dashboard chart (Github).


  • Oussama Boudhri
    Posted on 5 juillet 2018 at 13 h 53 min

    Interesting article thxx 🙂


Leave a comment