Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install kubernetes 1.6 on centos 7.3

install kubernetes 1.6 on centos 7.3

Install kubelet, kubeadm, docker, kubectl and kubernetes-cni

1. Install Yum Repo

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
        https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

2. Disable SELinux

setenforce 0

3. Install from yum

yum install -y docker kubelet kubeadm kubectl kubernetes-cni

4. Enable docker and kubelet

systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet

5. Edit the 10-kubadm.conf see

vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

Add the following before "ExeStart="

Environment="KUBELET_EXTRA_ARGS=--cgroup-driver=systemd"

6. Enable Overlay FS

sudo tee /etc/modules-load.d/overlay.conf <<-'EOF'
overlay
EOF

7. Reboot to reload kernel modules

reboot

8. Verify that OverlayFS is enabled:

lsmod | grep overlay
overlay

9. Edit the docker-storage-setup file

vi /etc/sysconfig/docker-storage-setup

add

STORAGE_DRIVER="overlay"

10. Start Docker and Kubelet Services

systemctl start docker
systemctl start kubelet
@rsjethani

This comment has been minimized.

Copy link

rsjethani commented May 26, 2017

Hey what about configuring slave?

@kshailen

This comment has been minimized.

Copy link

kshailen commented Jun 8, 2017

I think We need to run kubeadm init command , and then get discovery token

@githubvick

This comment has been minimized.

Copy link

githubvick commented Jul 27, 2017

@patrickhuber Hi Patrick, I'm trying to install Kubernetes 1.7(or 1.6) on Centos 7 , but standalone components and not kubeadm. Seems like the centos yum repositories also doesnt have it still and there is not a 1.7 RPM as well for redhat or Centos. Could you please suggest any way to install/upgrade? Thanks.

@vbmade2000

This comment has been minimized.

Copy link

vbmade2000 commented Aug 7, 2017

@patrickhuber Thanks a lot. Please include sysctl net.bridge.bridge-nf-call-iptables=1 in steps. Kubeadm init asks me to execute this everytime. It can be set permanently in /etc/sysctl.conf too.

@vkumar2808

This comment has been minimized.

Copy link

vkumar2808 commented Oct 10, 2017

Hi did we get working k8s on centos7?

@sachinar

This comment has been minimized.

Copy link

sachinar commented Nov 16, 2017

Hi,
I had done same steps but it's showing an error.

systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Thu 2017-11-16 08:49:03 UTC; 2s ago
Docs: http://kubernetes.io/docs/
Process: 2382 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 2382 (code=exited, status=1/FAILURE)

Nov 16 08:49:03 master1.com systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Nov 16 08:49:03 master1.com systemd[1]: Unit kubelet.service entered failed state.
Nov 16 08:49:03 master1.com systemd[1]: kubelet.service failed.

@semad

This comment has been minimized.

Copy link

semad commented Nov 23, 2017

Perfect! Thanks!
Actually, from your instructions, I made an Ansible playbook, with that I created a basic Cenots7.3/Docker/Kubelet VM. After imaging, this VM, I created a cluster of VMs having Kubelet and Docker running. And then followed these instructions: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm to start the master node, and join the next ones. Now, I am running k8s v1.8.4. Thanks again.

@vevsatechnologies

This comment has been minimized.

Copy link

vevsatechnologies commented Mar 24, 2018

For any issue you can checkout this documentation
https://github.com/vevsatechnologies/Install-Kubernetes-on-CentOs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.