Kubernetes Installation on Fedora 27 Cloud Base

Kubernetes Installation on Fedora 27 Cloud Base

Getting Started

I tried numerous ways to get a Kubernetes Master node to be installed on my bare-metal Fedora 25 distribution without success. With Kubernetes under such rapid development, it can be difficult to find a distribution platform which is able to keep up. Fedora 26 is represents a milestone in the development of Kubernetes, where instead of running the components of Kubernetes directly as services on the Master node, they have been containerized.

This post explains how to install a Kubernetes Master node using containers on a Linux host running Fedora 25. This host has libvirt installed already for storing the container metadata.

Managing Cloud Base Container

The container which will run the Kubernetes containers will be managed using Vagrant. Although the Vagrant documentation recommends installing directly from https://www.vagrantup.com/downloads.html, there is no package for the Fedora distribution there. If you are on a Windows, Mac, CentOS, or Debian platform, then you can install the vagrant software there. On Fedora, it was installed with:

dnf install vagrant

Obtaining the Fedora 27 Cloud Base container

vagrant box add fedora/27-cloud-base

Initializing the Vagrant Environment

To download the container image, first a "box" has to be added to vagrant. To create a download the image and create a Vagrantfile to customize how you deploy this image:

mkdir k8s-master; cd k8s-master
vagrant init fedora/27-cloud-base 

You can customize many options for the container like memory, networking, shared directories, port forwarding, etc. If the above command was executed with the minimal option -m, comments would not have been provided. To get started, you need to allocate more than the 500 megabytes of memory that is normally provided. If you can afford the memory, allocate the 2,048 gigabytes by using the customization below.

Assuming you are using libvirt, add the following lines to the Vagrantfile after the "config.vm.box = fedora/27-cloud-base" line:

     config.vm.hostname = "k8s-master"
  config.vm.provider "libvirt" do |libvirt, override|
    libvirt.memory = 2048
    libvirt.nested = true

Starting and Accessing the Fedora 27 Cloud Base Container

vagrant up 
vagrant ssh
sudo -i

Create the Kubernetes Repository File

cat > /etc/yum.repos.d/kubernetes.repo << HERE


Install the Packages

dnf install kubeadm.x86_64 kubectl.x86_64 kubelet.x86_64 kubernetes-cni.x86_64 bash-completion rsyslog docker -y

Configure the Kubelet service

Add to the /etc/systemd/system/kubelet.service.d/10-kubeadm.conf file $KUBELET_KUBECONFIG_ARGS:

--runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice

Reload systemd

For the updated kubelet configuration to be recognized, systemd must be reloaded.

systemctl daemon-reload
systemctl enable kubelet
systemctl restart kubelet

Enable and Start the Services

systemctl enable docker --now
systemctl enable rsyslog --now
systemctl enable kubelet --now

Initialize the Kubernetes Cluster

kubeadm init --pod-network-cidr

Prepare Home Directory 

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
echo 'source <(kubectl completion bash)' >> .bashrc
source .bashrc

Apply the Weave Network

kubectl apply -f https://git.io/weave-kube-1.6

Untaint the Master Node

kubectl taint nodes --all node-role.kubernetes.io/master-

If necessary the node can be re-tainted by executing:

kubectl taint nodes --all node-role.kubernetes.io/master=""

Get Cluster Information

kubectl cluster-info

Kubernetes master is running at

KubeDNS is running at

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'

No comments:

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.