error 발생
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 15s default-scheduler Successfully assigned default/testdeploy-cff5cf7d9-mws8j to kw1.dd.io
Normal Pulling 14s kubelet Pulling image "harbor.ks.io/privatetest/flasktest:latest"
Warning Failed 14s kubelet Failed to pull image "harbor.ks.io/privatetest/flasktest:latest": rpc error: code = Unknown desc = Error response from daemon: unauthorized: unauthorized to access repository: privatetest/flasktest, action: pull: unauthorized to access repository: privatetest/flasktest, action: pull
Warning Failed 14s kubelet Error: ErrImagePull
Normal SandboxChanged 13s kubelet Pod sandbox changed, it will be killed and re-created.
Normal BackOff 11s (x3 over 12s) kubelet Back-off pulling image "harbor.ks.io/privatetest/flasktest:latest"
Warning Failed 11s (x3 over 12s) kubelet Error: ImagePullBackOff
docker login -> 동일 에러 발생
docker login harbor.ks.io
시크릿 생성 (from-file에는 절대경로를 적어줘야함)
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=/root/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
# 서비스 어카운트가 시크릿을 사용하게 패치
[root@kw1 flasktest]# kubectl get serviceaccount
NAME SECRETS AGE
default 1 13d
[root@kw1 flasktest]# kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "regcred"}]}'
serviceaccount/default patched
시크릿 패치 후 확인해보니 잘 동작함
[root@kw1 flasktest]# kubectl create deploy testdeploy --image=harbor.ks.io/privatetest/flasktest:latest
deployment.apps/testdeploy created
[root@kw1 flasktest]# kubectl get pod
NAME READY STATUS RESTARTS AGE
testdeploy-cff5cf7d9-qj2xh 1/1 Running 0 5s
'kubenetes' 카테고리의 다른 글
docker 이미지 수정하는 방법 (1) | 2022.04.05 |
---|---|
k8s flask web 수정하기 (0) | 2022.04.04 |
kubernetes 실행 중인 pod에 접속해 package 설치 (0) | 2022.03.30 |
kubernetes pod에 파일 복사하고 다운로드 받기 (0) | 2022.03.30 |
kubernetes python flask ingress 설정하기 (0) | 2022.03.27 |
댓글