Intitializing the Kubernetes cluster

8/26/2019

I am trying to install the Kubernetes cluster on ubuntu 18.04 system..

As part of intializing the cluster with below command getting below error

        [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-apiserver:v1.14.0: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-controller-manager:v1.14.0: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-scheduler:v1.14.0: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-proxy:v1.14.0: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/pause:3.1: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/etcd:3.3.10: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/coredns:1.3.1: output: Error response from daemon: Get https://k8s.gcr.io/v2/: remote error: tls: access denied
, error: exit status 1

When i tried to run wget https://k8s.gcr.io/v2/ i am getting below error:

Proxy request sent, awaiting response... 401 Unauthorized
Username/Password Authentication Failed.

Can you please let me know what is the issue.

-- surya135
docker
kubernetes

1 Answer

8/26/2019

In my case I have

[root@instance-1 ~]# wget https://k8s.gcr.io/v2/
--2019-08-26 12:58:24--  https://k8s.gcr.io/v2/
Resolving k8s.gcr.io (k8s.gcr.io)... 64.233.167.82, 2a00:1450:400c:c06::52
Connecting to k8s.gcr.io (k8s.gcr.io)|64.233.167.82|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.

That can be the proxy issue. Inspect [Kubeadm] Failing to pull images, and more concrete [this answer](https://github.com/kubernetes/kubeadm/issues/1201#issuecomment-494686022.

So try to configure your docker to use proxy and I hope your issue would be resolved.

And below is summarized set of commands for both the methods:

Method 1 : Configuring proxy variables in the /etc/sysconfig/docker file

-Add following configuration in /etc/sysconfig/docker file

# cat /etc/sysconfig/docker
HTTP_PROXY="http://USERNAME:PASSWORD@[your.proxy.server]:[port]"
HTTPS_PROXY="https://USERNAME:PASSWORD@[your.proxy.server]:[port]

-Restart docker

# service docker restart

Method 2:

1) Create a drop-in

# mkdir /etc/systemd/system/docker.service.d

2) Create a file with name /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://user01:password@10.10.10.10:8080/"
Environment="HTTPS_PROXY=https://user01:password@10.10.10.10:8080/"
Environment="NO_PROXY= hostname.example.com,172.10.10.10"

3) reload the systemd daemon

# systemctl daemon-reload

4) restart docker

# systemctl restart docker 5) Verify that the configuration has been loaded:

# systemctl show docker --property Environment
Environment=GOTRACEBACK=crash HTTP_PROXY=http://10.10.10.10:8080/ HTTPS_PROXY=http://10.10.10.10:8080/ NO_PROXY= hostname.example.com,172.10.10.10
-- VKR
Source: StackOverflow