What happened: I setting up the secret (which works in ubuntu18.04 cluster) in my Kubernetes cluster (os: REHL7.8) and when trying to create a pod pulling from one of my docker hub private repo. Following is my command for creating secret:
kubectl create secret docker-registry regcred
--docker-server=index.docker.io
--docker-username=my-username
--docker-password=my-password
--docker-email=my-email
Here is the yaml file I use for creating pod:
apiVersion: v1
kind: Pod
metadata:
name: test-reg
spec:
containers:
- name: test-reg-container
image: docker.io/memo40k/test:v1
imagePullSecrets:
- name: regcred
And I always got the following response when creating the pod:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 13s default-scheduler Successfully assigned default/test-reg to wistron-4
Normal Pulling 0s kubelet Pulling image "docker.io/repo-name/test:v1"
Warning Failed <invalid> kubelet Failed to pull image "docker.io/repo-name/test:v1": rpc error: code = Unknown desc = repository docker.io/memo40k/test not found: does not exist or no pull access
Warning Failed <invalid> kubelet Error: ErrImagePull
Normal BackOff <invalid> kubelet Back-off pulling image "docker.io/repo-name/test:v1"
Warning Failed <invalid> kubelet Error: ImagePullBackOff
I also tried direct docker pull target image after docker login, and it works fine.
What you expected to happen: Pod should be able to pull image from docker-hub private repo
How to reproduce it (as minimally and precisely as possible): Build a one node k8s cluster with RHEL 7.8 and trying to create pod using private repo image
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): v1.18.9
- Cloud provider or hardware configuration:
- OS (e.g:
cat /etc/os-release
): RHEL 7.8
- Kernel (e.g.
uname -a
): 3.10.0-1127.el7.x86_64
- Install tools: kubeadm
- Network plugin and version (if this is a network-related bug): flannel v0.13.1
Thanks in advance for your great help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…