Skip to content

Instantly share code, notes, and snippets.

@antonputra
Last active February 12, 2023 10:07
Show Gist options
  • Save antonputra/a1125083788346b92afc84887444e55e to your computer and use it in GitHub Desktop.
Save antonputra/a1125083788346b92afc84887444e55e to your computer and use it in GitHub Desktop.
Offline Kubernetes installation with kubeadm and CentOS 7 v1.10.5

On master and nodes

Set environment variables

export MASTER01=<user>@<server>:<path>/<to>/<remote>/<folder>

Install docker daemon | 17.03 version recommended with k8s v.1.10.5

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

Download docker-ce rpm

wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

Copy docker-ce rpm to the target

{
    scp docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm $MASTER01
    scp docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm $MASTER01
}

Install Docker

If you will get error initializing graphdriver: driver not supported, run sudo rm -rf /var/lib/docker and reinstall docker.

{
    yum install -y docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
    yum install -y docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
    systemctl enable docker && systemctl start docker
}

Download kubernetes rpms

wget https://packages.cloud.google.com/yum/pool/94d062f2d86b8f4f55f4d23a3610af25931da9168b7f651967c269273955a5a2-kubelet-1.10.5-0.x86_64.rpm
wget https://packages.cloud.google.com/yum/pool/1eed768852fa3e497e1b7bdf4e93afbe3b4b0fdcb59fda801d817736578b9838-kubectl-1.10.5-0.x86_64.rpm
wget https://packages.cloud.google.com/yum/pool/fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm
wget https://packages.cloud.google.com/yum/pool/3ea9c50d098c50a7e968c35915d3d8af7f54c58c0cedb0f9603674720743de4e-kubeadm-1.10.5-0.x86_64.rpm

Copy rpms to targets

scp *.rpm $MASTER01

Install kubelet, kubeadm, and kubectl

setenforce 0
yum -y install *.rpm
rpm -ivh fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm --nodeps
yum install -y 94d062f2d86b8f4f55f4d23a3610af25931da9168b7f651967c269273955a5a2-kubectl-1.10.5-0.x86_64.rpm
rpm -ivh 3ea9c50d098c50a7e968c35915d3d8af7f54c58c0cedb0f9603674720743de4e-kubeadm-1.10.5-0.x86_64.rpm --nodeps
systemctl enable kubelet && systemctl start kubelet

For Centos7, enable sysctl configuration

cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

Pull docker images

docker pull k8s.gcr.io/kube-controller-manager-amd64:v1.10.5
docker pull k8s.gcr.io/kube-apiserver-amd64:v1.10.5
docker pull k8s.gcr.io/kube-proxy-amd64:v1.10.5
docker pull k8s.gcr.io/kube-scheduler-amd64:v1.10.5
docker pull quay.io/calico/node:v3.1.3
docker pull quay.io/calico/cni:v3.1.3
docker pull k8s.gcr.io/etcd-amd64:3.1.12
docker pull k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8
docker pull k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8
docker pull k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8
docker pull k8s.gcr.io/pause-amd64:3.1
@Abhishek1095
Copy link

after pulling docker images, what is the next step?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment