Multi-node Kubernetes on CentOS 7.x with Flannel

Mode: Multi-node setup, with Flannel, using Kismatic repo.

— DEPRECATED (may work; not tested lately) —

This is the common script (kube-base.txt) that we run on every machine. Please tweak it for your environment (mainly IPs) and drop it on some web location.

# file: kube-base.txt
# add docker repo and install docker
cat > /etc/yum.repos.d/docker.repo << '__EOF__'
name=Docker Repository
yum install docker-engine -y
mkdir -p /etc/systemd/system/docker.service.d 
cat > /etc/systemd/system/docker.service.d/override.conf << '__EOF__'
ExecStart=/usr/bin/docker daemon --storage-driver=overlay $DOCKER_NETWORK_OPTIONS
systemctl daemon-reload
systemctl enable docker
# we'll start docker only after flannel is up and running
# systemctl start docker
tee -a /etc/hosts << '__EOF__' kube-master kube-node-01 kube-node-02 kube-node-03


# tweak it as per your setup
curl -s | bash
yum install etcd flannel -y
cat > /etc/etcd/etcd.conf << '__EOF__'
# [member]
systemctl enable etcd
systemctl start etcd
sleep 5
echo '{"Network": "", "SubnetLen": 24, "Backend": {"Type": "vxlan", "VNI": 1}}' | etcdctl set /
etcdctl get /
systemctl enable flanneld
systemctl start flanneld
# verify
curl -s http://kube-master:2379/v2/keys/ | python -m json.tool
curl -s http://kube-master:2379/v2/keys/ | python -m json.tool
systemctl start docker

=== NODE PREP ===

# tweak it as per your setup
curl -s | bash
# verify
curl -s http://kube-master:2379/v2/keys/ | python -m json.tool
curl -s http://kube-master:2379/v2/keys/ | python -m json.tool
yum install flannel -y
cat > /etc/sysconfig/flanneld << '__EOF__'
systemctl enable flanneld
systemctl start flanneld
systemctl start docker

=== KUBE SETUP ===

Kismatic has done a great job in packaging the Kubernetes.

@ MASTER – default RPM works as it is

yum install -y
yum install kubernetes-master -y
for SERVICE in kube-apiserver kube-scheduler kube-controller-manager kubelet
    systemctl restart $SERVICE
    systemctl enable $SERVICE

@ NODES – minor config tweaking is needed

yum install -y
yum install kubernetes-node -y
cat > /etc/kubernetes/node/kube-proxy.conf << '__EOF__'
# kubernetes proxy config
# default config should be adequate
#Master api server http (--insecure-port) port=8080
#Master api server https (--secure-port) port=6443
cat > /etc/kubernetes/node/kubelet.conf << '__EOF__'
# kubernetes kubelet (node) config
# The address for the info server to serve on (set to or "" for all interfaces)
# The port for the info server to serve on
# You may leave this blank to use the actual hostname
# location of the api-server
# Add your own!
KUBELET_ARGS="--container_runtime=docker --config=/etc/kubernetes/manifests"
for SERVICE in kube-proxy kubelet
    systemctl restart $SERVICE
    systemctl enable $SERVICE

=== VERIFY ===

[root@kube-master ~]# kubectl get nodes
NAME           STATUS    AGE
kube-node-01   Ready     1m
kube-node-02   Ready     38s
kube-node-03   Ready     12s



API server is insecure so default won’t work; specify http://master_ip:8080; hostname (or private DNS) won’t work either.

            # Uncomment the following line to manually specify Kubernetes API server Host
            # If not specified, Dashboard will attempt to auto discover the API server and connect
            # to it. Uncomment only if the default does not work.
            # - --apiserver-host=http://my-address:port
            - --apiserver-host=
kubectl create namespace kube-system
kubectl create -f kubernetes-dashboard.yaml



=== RPM DETAILS (for reference) ===

[root@kube-master ~]# rpm -ql kubernetes-master
[root@kube-node-03 ~]# rpm -ql kubernetes-node

15 thoughts on “Multi-node Kubernetes on CentOS 7.x with Flannel”

  1. Hi! could you prepare an article about using Flocker in Kubernetes or better integration with OpenShift? Thanks!

  2. Dear Sudhakar,
    I get this error , on node-01 ,when i try to start flanneld service.Kindly suggest.

    [root@kube-node-01 ~]# cat /etc/redhat-release
    CentOS Linux release 7.1.1503 (Core)
    [root@kube-node-01 ~]#

    [root@kube-node-01 ~]# systemctl status flanneld.service -l
    ● flanneld.service – Flanneld overlay address etcd agent
    Loaded: loaded (/usr/lib/systemd/system/flanneld.service; enabled; vendor preset: disabled)
    Active: activating (start) since Sun 2016-05-08 00:50:58 IST; 1min 23s ago
    Main PID: 1503 (flanneld)
    Memory: 8.4M
    CGroup: /system.slice/flanneld.service
    └─1503 /usr/bin/flanneld -etcd-endpoints=http://kube-master:2379 -etcd-prefix=/

    May 08 00:52:12 kube-node-01 flanneld[1503]: E0508 00:52:12.241148 01503 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured

  3. For the ‘curl’ command under ==Master Prep== I get a timeout for the script download. Are they still at this location?

    1. That script is hosted internally in my LAN.

      First code block has the entire content of the file: kube-base.txt ; tweak it and copy it somewhere local. Your IP etc. will be different so you can’t use my file anyway.

  4. Dear Sudhaker,
    My original comment was corrected when I returned an hour later… the timeout issue went away and all worked fine. THANKS for these very helpful posts, your time and effort in this problem space.

    Perhaps I am missing a very simple thing, which is likely as I am somewhat new to OpenShift. I am unable to access port 8080. All is up and run per the OpenShift management display. In the topographical view is see the Deployment Config, Replication Controller, 2 pods, the Service, and the route. All appear to be fine.
    My local host is my internal IP address 10.xx.xx.62, the pods are on &, docker appears to be 172.xx.xx.238:5000, and my-node-app is:

    name my-node-app
    Hostname: – exposed on router ‘router’ 3 hours ago
    Path: none (IS THIS THE ISSUE ??? If so, how does one set this path value or more to the point “where”.)
    Service: my-node-app
    Target Port: 8080-tcp
    This target port will route to Service Port 8080 → Container Port 8080 (TCP).
    TLS Settings TLS is not enabled for this route

    1. Dewittm,

      It’s great that you took K8S instruction and used it to run a multi-node Openshift V3. I haven’t played with this possible setup yet and would be very interested in learning from your experience. I can be reached at

      Openshift recommends using Ansible for their multi-node deployment and under-the-hood uses OvS (Open vSwitch) for their SDN. I was planning to use the similar stack for my manual multi-node setup (sitting on my TODO list for a bit).

      I love manual setup from scratch which gives me full exposure of each and every component. Great to meet and work with similar minded people.


  5. My apologies, for my last two posts! I worked through the initial obvious: I “assumed” that the host (i.e. had been mapped to from the application: WRONG ON MY PART. I found the Cluster Address and found the “Colorful” app on port 8080. I will continue working through your site and be more considerate of your time by working longer before posting. THANKS AGAIN for all. – Dewittm

  6. Hi Sudhaker,

    This is the best kubernetes installer I’ve read. The latest docker release seems to have broken the master install.

    The kube-base.txt script installs docker 1.11 but ‘yum install kubernetes-master’ rpm is dependent on docker 1.10. So I had to ‘rpm -e docker-engine’ and docker-engine-selinux to install the master package.

    But then you get:
    [root@kube-master jkong]# systemctl status docker.service
    ● docker.service – Docker Application Container Engine
    Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/docker.service.d
    Active: failed (Result: exit-code) since Sun 2016-07-10 19:36:48 PDT; 4s ago
    Process: 2635 ExecStart=/usr/bin/docker daemon –storage-driver=overlay $DOCKER_NETWORK_OPTIONS -H fd:// (code=exited, status=1/FAILURE)
    Main PID: 2635 (code=exited, status=1/FAILURE)

    Jul 10 19:36:48 kube-master systemd[1]: Starting Docker Application Container Engine…
    Jul 10 19:36:48 kube-master systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    Jul 10 19:36:48 kube-master systemd[1]: Failed to start Docker Application Container Engine.
    Jul 10 19:36:48 kube-master systemd[1]: Unit docker.service entered failed state.
    Jul 10 19:36:48 kube-master systemd[1]: docker.service failed.

    Any suggestion how to fix?

  7. Hey Sudhaker,

    Found a fix for above. I removed the ‘-H fd://’ option in file override.conf. This removes the socket option for systemd systems.

    1. Ouch! Kismatic was recently acquired by Apprenda. Let me ask those guys if they still maintain the repo.

      My focus is mostly on Mesos these days so was not following on K8S.

Leave a Reply

Your email address will not be published. Required fields are marked *