没有https的情况下,Kubernetes不会从私有存储库中提取docker镜像 [英] Kubernetes does not pull docker image from private repository without https
问题描述
我将docker配置为与kubernetes-master相同的主机上用于私有Docker注册表.
Docker在没有https的情况下成功推送到私有docker注册表.
我也可以仅使用docker提取映像.
I configured docker on the same host as my kubernetes-master for the private docker registry.
Docker pushing to the private docker registry without https was successful.
I also can pull the image just using docker.
当我为该图像运行kubernetes时,我在日志后看到"kubectl describe pods":
When I run kubernetes for this image, I get with 'kubectl describe pods' following log :
kubectl describe pods
Name: fgpra-250514157-yh6vb
Namespace: default
Node: 5.179.232.64/5.179.232.64
Start Time: Tue, 11 Oct 2016 18:06:59 +0200
Labels: pod-template-hash=250514157,run=fgpra
Status: Pending
IP: <removed myself>
Controllers: ReplicaSet/fgpra-250514157
Containers:
fgpra:
Container ID:
Image: 5.179.232.65:5000/some_api_image
Image ID:
Port: 3000/TCP
QoS Tier:
cpu: BestEffort
memory: BestEffort
State: Waiting
Reason: ErrImagePull
Ready: False
Restart Count: 0
Environment Variables:
Conditions:
Type Status
Ready False
Volumes:
default-token-q7u3x:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-q7u3x
Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
4s 4s 1 {default-scheduler } Normal Scheduled Successfully assigned fgpra-250514157-yh6vb to 5.179.232.64
4s 4s 1 {kubelet 5.179.232.64} Warning MissingClusterDNS kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
4s 4s 1 {kubelet 5.179.232.64} spec.containers{fgpra} Normal Pulling pulling image "5.179.232.65:5000/some_api_image"
4s 4s 1 {kubelet 5.179.232.64} spec.containers{fgpra} Warning Failed Failed to pull image "5.179.232.65:5000/some_api_image": unable to ping registry endpoint https://5.179.232.65:5000/v0/
v2 ping attempt failed with error: Get https://5.179.232.65:5000/v2/: http: server gave HTTP response to HTTPS client
v1 ping attempt failed with error: Get https://5.179.232.65:5000/v1/_ping: http: server gave HTTP response to HTTPS client
4s 4s 1 {kubelet 5.179.232.64} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "fgpra" with ErrImagePull: "unable to ping registry endpoint https://5.179.232.65:5000/v0/\nv2 ping attempt failed with error: Get https://5.179.232.65:5000/v2/: http: server gave HTTP response to HTTPS client\n v1 ping attempt failed with error: Get https://5.179.232.65:5000/v1/_ping: http: server gave HTTP response to HTTPS client"
3s 3s 1 {kubelet 5.179.232.64} spec.containers{fgpra} Normal BackOff Back-off pulling image "5.179.232.65:5000/some_api_image"
3s 3s 1 {kubelet 5.179.232.64} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "fgpra" with ImagePullBackOff: "Back-off pulling image \"5.179.232.65:5000/some_api_image\""
我已经将/etc/init.d/sysconfig/docker配置为使用不安全的私有注册表.
I already configured my /etc/init.d/sysconfig/docker to use my insecure private registry.
这是启动kubernetes部署的命令:
This is the command to start the kubernetes deployment :
kubectl run fgpra --image=5.179.232.65:5000/some_api_image --port=3000
如何设置kubernetes从我的私有Docker注册表中拉出而不使用ssl?
How can I set kubernetes to pull from my private docker registry without using ssl?
推荐答案
这是一个docker问题,而不是kubernetes问题.您需要将http注册表作为insecure-registry
添加到每个kubernetes节点上的docker守护程序中.
This rather a docker issue than a kubernetes one. You need to add your http registry as a insecure-registry
to your docker daemon on each kubernetes node.
docker daemon --insecure-registry=5.179.232.65:5000
在大多数环境中,都有一个文件,例如/etc/default/docker
,您可以在其中添加此参数.
In most environment there is a file like /etc/default/docker
where you can add this parameter.
这篇关于没有https的情况下,Kubernetes不会从私有存储库中提取docker镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!