Installing kubernetes behind a corporate proxy

Vivekanand Poojari
1 min readMay 24, 2020
k8s Networking

This blog post is about installing kubernetes behind a corporate proxy network.

Assuming your http proxy is : http://10.115.27.54:3128

Configure yum to use the proxy

Add the following line to /etc/yum.conf

proxy=http://10.115.27.54:3128

Configure the container runtime to use a proxy

For docker

sudo mkdir -p /etc/systemd/system/docker.service.d

create a file /etc/systemd/system/docker.service.d/http-proxy.conf

cat /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]

Environment=”HTTP_PROXY=http://10.115.27.54:3128"

Environment=”HTTPS_PROXY=http://10.115.27.54:3128"

Restart the docker daemon

systemctl daemon-reload

systemctl restart docker

For containerd

sudo mkdir -p /etc/systemd/system/containerd.service.d

Create a file http-proxy.conf

cat /etc/systemd/system/containerd.service.d/http-proxy.conf

[Service]

Environment=”HTTP_PROXY=http://10.115.27.54:3128"

Environment=”HTTPS_PROXY=http://10.115.27.54:3128"

Restart the containerd daemon

systemctl daemon-reload

systemctl restart containerd

For cri-o

sudo mkdir -p /etc/systemd/system/crio.service.d

Create a file http-proxy.conf

cat /etc/systemd/system/crio.service.d/http-proxy.conf

[Service]

Environment=”HTTP_PROXY=http://10.115.27.54:3128"

Environment=”HTTPS_PROXY=http://10.115.27.54:3128"

Restart the crio daemon

systemctl daemon-reload

systemctl restart crio

Set the http_proxy and no_proxy for your bash environment

Update ~/.bashrc with following

export http_proxy=http://10.115.27.54:3128

export https_proxy=http://10.115.27.54:3128

export no_proxy=localhost,127.0.0.1,127.0.0.0,127.0.1.1,127.0.1.1,local.home,10.115.110.76,10.115.110.77,10.96.0.0/12,10.88.0.0/16

Here ,

10.115.110.76 is my master node IP

10.115.110.77 is my worker node IP

10.96.0.0/12 is the service CIDR for kubernetes services

10.88.0.0/16 is the pod network cidr (Provided during kubeadm init)

--

--