All in one Kubernetes cluster on Fedora

This tutorial will walk through the installation steps of Kubernetes, which will run Kubernetes Master and Kubernetes Node on the same machine. Setup a Fedora VM and follow along

Install required packages:

sudo -i
dnf -y install --enablerepo=updates-testing kubernetes etcd iptables openssl

Create a entry for localhost, fed-master and fed-minion. These are all because we are doing all-in-one setup. We are also adding localhost entry because sometime not having this has caused failure.

echo " localhost fed-master fed-node
" >> /etc/hosts

Disable and Stop iptables and firewalld

systemctl disable iptables-services firewalld
systemctl stop iptables-services firewalld

File /etc/kubernetes/apiserver should look like as follows. Make sure service-cluster-ip-range does not overlap with any of network attached to your machine

# The address on the local server to listen to.

# Comma separated list of nodes in the etcd cluster

# Address range to use for services

# Add your own!

Make /var/run/kubernetes

mkdir /var/run/kubernetes
chown kube:kube /var/run/kubernetes
chmod 750 /var/run/kubernetes

Generate certificates to configure service account

mkdir -p /etc/pki/kube-apiserver
openssl genrsa -out /etc/pki/kube-apiserver/serviceaccount.key 2048
sed -i.back '/KUBE_API_ARGS=*/c\KUBE_API_ARGS="--service_account_key_file=/etc/pki/kube-apiserver/serviceaccount.key"' /etc/kubernetes/apiserver
sed -i.back '/KUBE_CONTROLLER_MANAGER_ARGS=*/c\KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/etc/pki/kube-apiserver/serviceaccount.key"' /etc/kubernetes/controller-manager

Start all the services required for Kubernetes Master and Kubernetes Node both

for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler kube-proxy kubelet docker; do
	systemctl restart $SERVICES
	systemctl enable $SERVICES
	systemctl status $SERVICES

If all the services started correctly that means that Kubernetes all-in-one cluster is set and you can use it. Here are some optional steps to verify if this cluster is setup.

Create a pod definition like this below

# cat pod.json 
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "labels": {
            "app": "apache-centos7"
        "name": "apache-centos7"
    "spec": {
        "containers": [
                "image": "centos/httpd",
                "name": "apache-centos7",
                "ports": [
                        "containerPort": 80,
                        "hostPort": 80,
                        "protocol": "TCP"

Create a pod using that pod definition

# kubectl create -f ./pod.json 
pod "apache-centos7" created

See if that pod is created

# kubectl get pod
apache-centos7   0/1       Pending   0          48s

Wait until the pod’s status changes from Pending to Running

# kubectl get pod
apache-centos7   1/1       Running   0          5m

Get the IP address of the Pod

# kubectl describe pod apache-centos7 | grep 'IP:'

See for yourself the output

# curl



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s