How to Install Kubernetes (k8s) 1.7 on CentOS 7 / RHEL 7

Pradeep Kumar

I am a huge fan of open source and love to share How To’s tutorials on Linux, Cloud and DevOps. I have been working as Linux Consultant, Cloud & DevOps Engineer since 2010

You may also like...

21 Responses

  1. Danil says:

    Thank you, very useful!

  2. Nitin Pawar says:

    Thank you very much Pradeep. I followed your guide and I am successfully able to make K8s network

  3. Rama says:

    Agreed, thanks for taking the time to put this out there.

  4. bodhi says:

    Thank you very much for your sharing! Please let me ask one question, could baseurl in Kubernetes Repositories file be changed to other URL which can be accessed from china? since domain google.com isn’t available from china.

  5. Lucky says:

    Hi Would you know what would cause this error on Kubelet?
    Oct 04 08:09:19 kube1 kubelet[5811]: error: failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: “systemd” is different from docker cgroup driver:
    Oct 04 08:09:19 kube1 systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
    Oct 04 08:09:19 kube1 systemd[1]: Unit kubelet.service entered failed state.
    Oct 04 08:09:19 kube1 systemd[1]: kubelet.service failed.

  6. Eugene says:

    I did not have this, /proc/sys/net/bridge/, so ran the following to get that folder:

    modprobe br_netfilter

  7. vijay says:

    I see when i reboot my master k8s server, im not able to get any pods details and keep getting error

    The connection to the server 10.0.0.29:6443 was refused – did you specify the right host or port?

    I see etcd deosnt support server reboot and master server always should be up and running. if this the case then how can we support it. it may possible that our servers get down for any reason. please help. this is really bothering me. I see document is missing very important steps. i have been strugling with server reboot option and nothing helps me.
    my env is centos 7
    i have already done with following steps

    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config

    i see only option i have after server reboot to run kubeadm reset and then kubeadm init. If this is the case then it is very disappointing because in DC env, there are several servers and they get down on and off.
    please help me how to resolve failure after server reboot.

  8. Alex says:

    Works fine with 1.8.0 but doesn’t work with 1.8.1

  9. Alex says:

    heh, my fault
    I configured KUBELET_SWAP_ARGS=–fail-swap-on=false on master node, but missed to do it on worker

  10. Chris says:

    Great article.

    One comment / question, this will only work for CentOS 7 and not for RHEL . . or . . ?
    The newest docker CE versions (17.06 and above) won’t install on redhat, only docker EE.

    yum install docker -> No package docker available.

    Or did I mis something . . .?

  11. Egor says:

    When I installed packages on Amazon. I get an error:
    Error: Package: kubelet-1.8.1-0.x86_64 (kubernetes)
    Requires: iptables >= 1.4.21
    Installed: iptables-1.4.18-1.22.amzn1.x86_64 (installed)
    iptables = 1.4.18-1.22.amzn1

    I solved this problem:
    yum install ftp://fr2.rpmfind.net/linux/centos/7.3.1611/os/x86_64/Packages/iptables-1.4.21-17.el7.x86_64.rpm

  12. Alex says:

    The file /etc/sysconfig/selinux as supplied by CentOS is a symlink to /etc/selinux/config but running your sed command will _break_ that link and result in two separate files. You would need to use ‘–follow-symlinks’ on the sed command to preserve the symlink.

    • Alex says:

      so “sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/sysconfig/selinux” will not work and once you restart machine, you will get selinux enabled
      you need to use “sed -i –follow-symlinks ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/sysconfig/selinux”

  13. Ganesh says:

    Hi Pradeep,

    I followed your instruction and my Cluster is up and Running on CentOS 7, but while I deploy any container I see below errors.

    Error on /var/log/messages
    failed to read pod IP from plugin/docker: NetworkPlugin cni failed on the status hook for pod Unexpected command output Device “eth0”

    Error from kubelet log
    pod_workers.go:182] Error syncing pod 978265f7-b
    helpers.go:468] PercpuUsage had 0 cpus, but the
    remote_runtime.go:115] StopPodSandbox “94f7ad2e4
    kuberuntime_manager.go:780] Failed to stop sandb
    kuberuntime_manager.go:580] killPodWithSyncResul
    pod_workers.go:182] Error syncing pod 978265f7-b

    ContainerCreating from Long time
    tomcat tomcat-7cc899d96f-59zcd 0/1 ContainerCreating 0 9h

    Tried to deploy Dashboard but that too fails
    kube-system kubernetes-dashboard-747c4f7cf-cv6np 0/1 Init:0/1 0 4h

    Please advise what is issue here

    Best Regards
    Ganesh Kumar

  14. Harry says:

    Hi, Can we use the kubeadm join command to make master node join as worker . mean to say can I make master/worker on the same node?

  15. KubeNoob says:

    Hi, I keep getting some http failures while doing “kubeadm init”:
    [kubelet-check] It seems like the kubelet isn’t running or healthy.
    [kubelet-check] The HTTP call equal to ‘curl -sSL http://localhost:10255/healthz‘ failed with error: Get http://localhost:10255/healthz: dial tcp [::1]:10255: getsockopt: connection refused.
    [kubelet-check] It seems like the kubelet isn’t running or healthy.
    [kubelet-check] The HTTP call equal to ‘curl -sSL http://localhost:10255/healthz‘ failed with error: Get http://localhost:10255/healthz: dial tcp [::1]:10255: getsockopt: connection refused.

    Any idea?

    • thongchai says:

      1. Disable swap:
      cat /etc/fstab |grep swap
      #/dev/mapper/centos-swap swap swap defaults 0 0

      2. Restart server
      3. kubeadm init

  16. Ganesh says:

    Hi

    Did anyone setup HA Master Setup for Baremetal Centos, please guide step by step instruction if anyone did it

    Best Regards
    Ganesh

Leave a Reply

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