LoginSignup
2

More than 5 years have passed since last update.

CentOS7上に構築したKubernetesでイメージのダウンロードに失敗する

Posted at

CentOS7上に構築したKubernetesでイメージのダウンロードに失敗する

Kubernetesで遊ぼうとしてハマった。
まず、こちらの記事を参考にしつつ、AWS上にCentOS7のインスタンスを立ち上げてkubernetesの試験環境を構築した。
Kubernetesでクラスタ環境構築手順(1) - masterの作成 - Qiita

しかし、いざpodをデプロイしようとしたところContainerCreatingのまま進まず、以下のようなエラーが。

[centos@ip-172-20-1-31 ~]$ kubectl run nginx --image=nginx:1.11.3                                                                                                                                                                             
deployment "nginx" created
[centos@ip-172-20-1-31 ~]$ kubectl describe pod nginx                                                                                                                                                                                         
Name:           nginx-752720876-1cgfj
Namespace:      default
Node:           master/172.20.1.31
Start Time:     Mon, 11 Dec 2017 02:08:46 +0000
Labels:         pod-template-hash=752720876
                run=nginx
Status:         Pending
IP:
Controllers:    ReplicaSet/nginx-752720876
Containers:
  nginx:
    Container ID:
    Image:              nginx:1.11.3
    Image ID:
    Port:
    State:              Waiting
      Reason:           ContainerCreating
    Ready:              False
    Restart Count:      0
    Volume Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-kj7lz (ro)
    Environment Variables:      <none>
Conditions:
  Type          Status
  Initialized   True 
  Ready         False 
  PodScheduled  True 
Volumes:
  default-token-kj7lz:
    Type:       Secret (a volume populated by a Secret)
    SecretName: default-token-kj7lz
QoS Class:      BestEffort
Tolerations:    <none>
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason          Message
  ---------     --------        -----   ----                    -------------   --------        ------          -------
  6s            6s              1       {default-scheduler }                    Normal          Scheduled       Successfully assigned nginx-752720876-1cgfj to master
  6s            6s              1       {kubelet master}                        Warning         FailedSync      Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for registry.access.re
dhat.com/rhel7/pod-infrastructure:latest, this may be because there are no credentials on this request.  details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)"

証明書/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crtが見つからないらしい。
これ自体はシンボリックリンクになっていて、リンク先が存在しない模様。

[centos@ip-172-20-1-252 ~]$ ls -al /etc/docker/certs.d/registry.access.redhat.com/
total 0
drwxr-xr-x. 2 root root 27 Dec 11 00:17 .
drwxr-xr-x. 5 root root 75 Dec 11 00:17 ..
lrwxrwxrwx. 1 root root 27 Dec 11 00:17 redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem
[centos@ip-172-20-1-252 ~]$
[centos@ip-172-20-1-252 ~]$ ls /etc/ | grep rhsm
[centos@ip-172-20-1-252 ~]$

色々試してマスターノードにpython-rhsmをインストールして解決した。
証明書もインストールされて、イメージもダウンロードできるようになった。

$ sudo yum install python-rhsm

参考:https://access.redhat.com/ja/node/1379303
(python-rhsmを再インストールするとroot証明書を再インストールできるとの記載。そもそもこのパッケージ入ってなかった)

個人的に遊んでるだけなので、証明書の検証はスキップしても構わないのだけど、insecure的な設定をどこからできるのかがわからなかった。

これでやっとKubernetes触れる。。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2