By continuing to navigate on this website, you accept the use of cookies to serve you more relevant services & content .
For more information and to change the setting of cookies on your computer, please read our Cookie Policy.

Kubernetes Installation on BareMetal(Fedora)

Kubernetes:

    With years of experience in managing highly scalable products, google has released kubernetes an open source project which manages containerized applications across multiple hosts. Kubernetes is actively developed with more than 700 active developers. Kubernetes can be setup over any cloud platform any os. Its is based on etc which is a key value store that provides shared configuration and service discovery for clusters.

Kubernetes Services:

   Kubernetes consists of four core services:

  • etcd 
  • apiserver
  • controll manager
  • scheduler

   So all we have to do is run these services providing the servers ip addresses and the application we want to deploy.

Terminology:

Cluster : A cluster is a set of physical or virtual machines and other infrastructure resources used by Kubernetes to run your applications. Kubernetes can run anywhere.

Node : A node is a physical or virtual machine running Kubernetes, onto which pods can be scheduled.

Pod : Pods are a colocated group of application containers with shared volumes. They're the smallest deployable units that can be created, scheduled, and managed with Kubernetes. Pods can be created individually, but it's recommended to use a replication controller even if creating a single pod.

Replication controller :Replication controllers manage the lifecycle of pods. They ensure that a specified number of pods are running at any given time, by creating or killing pods as required.

Service : Services provide a single, stable name and address for a set of pods. They act as basic load balancers.

Label : Labels are used to organize and select groups of objects based on the key:value pairs.

Configuring Kubernetes on Fedora:

Prerequisites:
    At least we need to have two hosts, and each host should have docker configured. Here we assume fed-master as host1 which acts as master and fed-node being the slave on host2.

Install kubernetes on both fed-master and fed-node:

    yum -y install --enablerepo=updates-testing kubernetes

Install etcd on fed-master:

yum -y install etcd iptables

Edit /etc/hosts

echo "<host1_ip_addr_here>    fed-master
<host2_ip_addr_here>    fed-node" >> /etc/hosts

Configure etcd, edit /etc/kubernetes/config

KUBE_MASTER="--master=http://fed-master:8080"

KUBE_LOGTOSTDERR="--logtostderr=true"

KUBE_LOG_LEVEL="--v=0"

KUBE_ALLOW_PRIV="--allow-privileged=false"

Disable iptable service:

   To avoid firewall issues with docker we are disabling iptables service.

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

Configure kubernetes on  fed-master:

Edit etc/kubernetes/apiserver

KUBE_API_ADDRESS="--address=0.0.0.0"

KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:4001"

KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"

KUBE_API_ARGS=""

Edit /etc/etcd/etcd.conf

ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:4001"

Create /var/run/kubernetes on master:

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

Now lets start the services:

systemctl restart etcd
systemctl restart kube-apiserver
systemctl restart kube-controller-manager
systemctl restart kube-scheduler

Create following node.json file on Kubernetes master:

{
    "apiVersion": "v1",
    "kind": "Node",
    "metadata": {
        "name": "fed-node",
        "labels":{ "name": "fed-node-label"}
    },
    "spec": {
        "externalID": "fed-node"
    }
# create the fed-node over cluster
kubectl create -f ./node.json

the above node.json file illustrates the fed-node structure, it does not run the node so you will get unknown status as shown below:

$ kubectl get nodes
NAME                LABELS              STATUS
fed-node           name=fed-node-label     Unknown

Now configure the kubelet on the fed-node:

Edit /etc/kubernetes/kubelet

KUBELET_ADDRESS="--address=0.0.0.0"

KUBELET_HOSTNAME="--hostname-override=fed-node"

KUBELET_API_SERVER="--api-servers=http://fed-master:8080"

#KUBELET_ARGS=""

Start the services on host2(fed-node):

systemctl restart kube-proxy
systemctl restart kubelet
systemctl restart docker

That's it to check whether the node is up and ready execute:

$ kubectl get nodes
NAME                LABELS              STATUS
fed-node          name=fed-node-label     Ready
    Posted On
  • 28 May 2016
  • By
  • Micropyramid

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
TMUX - Sharing terminal between Users

More Often you wouldve come across sharing screens with applications like Teamviewer, Windows Remote Desktop Connection or remmina (if you're a linux user). But if ...

Continue Reading...
How to backup and restore mysql, postgresql and mongodb databases

Data loss can happen when we accidentally delete the files, or when server crashes or system fails, or when we applied migrations to the data ...

Continue Reading...
Celery With Supervisor

Celery is a task queue with focus on real-time processing, while also supports task scheduling. Task queues are used as mechanisms to distribute work across ...

Continue Reading...
open source packages

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties