初始化Kubernetes集群

时间:2019-08-26 08:31:30

标签: docker kubernetes

我正在尝试在ubuntu 18.04系统上安装Kubernetes集群。

作为使用下面的命令初始化群集的一部分,该错误低于错误

        [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

当我尝试运行wget https://k8s.gcr.io/v2/时,出现以下错误:

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

能否让我知道是什么问题。

1 个答案:

答案 0 :(得分:1)

我有

<ButtonGroup
            onPress={this.updateIndex}
            selectedIndex={selectedIndex}
            buttons={buttons}
            containerStyle={{ height: 100 }}
            //disabled={[0, 1, 2]}
            disabled={true} 
/> 

ADD_DETAILS(index) {
    if (index === 0) {
      console.log("clicked 0");
      this.requestDetails();
    }
  }

这可能是代理问题。检查[Kubeadm] Failing to pull images,更具体的是[此答案](https://github.com/kubernetes/kubeadm/issues/1201#issuecomment-494686022

因此,请尝试configure your docker to use proxy,希望您的问题得到解决。

下面总结了这两种方法的命令集:

方法1:在/ etc / sysconfig / docker文件中配置代理变量

-在/ etc / sysconfig / docker文件中添加以下配置

[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.

-重新启动docker

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

方法2:

1)创建一个插件

# service docker restart

2)创建一个名称为# mkdir /etc/systemd/system/docker.service.d 的文件,其中添加了/etc/systemd/system/docker.service.d/http-proxy.conf环境变量:

HTTP_PROXY

3)重新加载systemd守护程序

[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"

4)重新启动docker

# systemctl daemon-reload er 5)确认配置已加载:

# systemctl restart dock