{"id":231312,"date":"2021-12-08T10:19:17","date_gmt":"2021-12-08T02:19:17","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=231312"},"modified":"2021-11-30T09:20:58","modified_gmt":"2021-11-30T01:20:58","slug":"image-pullsecrets-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/image-pullsecrets-linux.html","title":{"rendered":"\u89e3\u51b3k8s\u4e2dnode\u62c9\u53d6\u955c\u50cf\u5931\u8d25\u95ee\u9898"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728k8s\u96c6\u7fa4\u7684\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u521d\u5b66\u8005\u53ef\u80fd\u4f1a\u78b0\u5230\u8fd9\u6837\u7684\uff08\u602a\u5f02\uff09\u95ee\u9898\uff1a \u5728\u4e00\u4e2ak8s\u96c6\u7fa4\u91cc\uff0c\u90e8\u7f72\u670d\u52a1\uff08\u7528\u7684\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\uff0c\u5982harbor\uff09\u7684\u65f6\u5019\uff0c\u53ea\u6709\u4e2a\u522bnode\u7684\u670d\u52a1\u662f\u90e8\u7f72\u6210\u529f\u7684\uff0c\u5176\u4ed6\u90fd\u662f\u90e8\u7f72\u5931\u8d25\u7684\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u9519\u8bef\u7684\u539f\u56e0\u5c31\u662f\u955c\u50cf\u62c9\u53d6\u5931\u8d25\uff0c\u5982\u4e0b\uff1a<\/p>\n

kubectl get pods -A -owide |grep jenkins-demo\r\ndevlopment     jenkins-demo-67d4f9d666-2fh8k            1\/1     Running            0          27m     10.244.2.40     local-k8s-nd02              \r\ndevlopment     jenkins-demo-dbc9f5b6b-h78tx             0\/1     ImagePullBackOff   0          6m4s    10.244.6.93     local-k8s-nd03              \r\nproduction     jenkins-demo-dbc9f5b6b-tnkfs             1\/1     Running            0          5m47s   10.244.2.44     local-k8s-nd02              \r\nqatest         jenkins-demo-67d4f9d666-hb22t            1\/1     Running            0          27m     10.244.2.41     local-k8s-nd02              \r\nqatest         jenkins-demo-dbc9f5b6b-d6txr             0\/1     ImagePullBackOff   0          6m      10.244.6.94     local-k8s-nd03<\/pre>\n

\u67e5\u770b\u5931\u8d25\u8be6\u60c5<\/p>\n

# kubectl describe pods -n qatest jenkins-demo-6cbfb64844-79n8l\r\n..........\r\nEvents:\r\n  Type     Reason     Age                From               Message\r\n  ----     ------     ----               ----               -------\r\n  Normal   Scheduled  78s                default-scheduler  Successfully assigned qatest\/jenkins-demo-6cbfb64844-79n8l to local-k8s-nd03\r\n  Normal   Pulling    37s (x3 over 78s)  kubelet            Pulling image \"dev-hub.jiatuiyun.net\/zeng\/my-demo:429d9c1\"\r\n  Warning  Failed     36s (x3 over 77s)  kubelet            Failed to pull image \"dev-hub.jiatuiyun.net\/zeng\/my-demo:429d9c1\": rpc error: code = Unknown desc = Error response from daemon: pull access denied for dev-hub.jiatuiyun.net\/zeng\/my-demo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied\r\n  Warning  Failed     36s (x3 over 77s)  kubelet            Error: ErrImagePull\r\n  Normal   BackOff    6s (x5 over 77s)   kubelet            Back-off pulling image \"dev-hub.jiatuiyun.net\/zeng\/my-demo:429d9c1\"\r\n  Warning  Failed     6s (x5 over 77s)   kubelet            Error: ImagePullBackOff\r\n<\/pre>\n

\u7136\u540e\u6211\u4eec\u53bb\u955c\u50cf\u62c9\u53d6\u5931\u8d25\u7684\u673a\u5668\u4e0a\uff0c\u76f4\u63a5\u7528\u547d\u4ee4\u62c9\u53d6\uff0c\u7adf\u7136\u662fok\u7684<\/p>\n

# docker pull dev-hub.jiatuiyun.net\/zeng\/my-demo:eb7ec1d\r\neb7ec1d: Pulling from zeng\/my-demo\r\n4fe2ade4980c: Already exists \r\n2e793f0ebe8a: Already exists \r\n77995fba1918: Already exists \r\n4495499e856d: Already exists \r\n0ff8f8e34aa6: Already exists \r\n6c24ea7b9085: Pull complete \r\nc07b8e5ec47b: Pull complete \r\nDigest: sha256:95077089b59358820c4c763ae8bc390e470c62ac3d212abfe38292ff6389c7bb\r\nStatus: Downloaded newer image for dev-hub.jiatuiyun.net\/zeng\/my-demo:eb7ec1d\r\ndev-hub.jiatuiyun.net\/zeng\/my-demo:eb7ec1d<\/pre>\n

\u540c\u4e00\u4e2a\u96c6\u7fa4\uff0c\u540c\u4e00\u4e2a\u955c\u50cf\u4ed3\u5e93\u7684\u540c\u4e00\u4e2a\u955c\u50cf\uff0c\u53ea\u662fnode\u4e0d\u540c\u800c\u5df2\uff0c\u4e2a\u522bnode\u62c9\u53d6\u955c\u50cfok\uff0c\u5176\u4f59node\u62c9\u53d6\u955c\u50cf\u5931\u8d25\uff0c\u4e3a\u4f55\uff1f \u5176\u5b9e\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u5c31\u5904\u5728\uff0c\u670d\u52a1\u7684\u90e8\u7f72\u6587\u4ef6\u91cc\u8fb9\u6ca1\u6709\u914d\u7f6e\u62c9\u53d6\u955c\u50cf\u7528\u7684secret\uff0c\u5728\u670d\u52a1\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u540d\u5b57\u662f imagePullSecrets \u5982\u4e0b\uff1a<\/p>\n

.....\r\n    spec:\r\n      imagePullSecrets:\r\n      - name: registry-pull-secret\r\n      containers:\r\n      - image: dev-hub.xxxxx.net\/zeng\/my-demo:\r\n        imagePullPolicy: IfNotPresent\r\n        name: jenkins-demo\r\n.....<\/pre>\n

\u6ce8\u610f\uff1a\u5982\u679c\u670d\u52a1\u5206\u5e03\u5728\u591a\u4e2a\u4e0d\u540c\u7684namespace\u4e0b\uff0c\u90a3\u5728\u8fd9\u4e9bnamespace\u4e0b\u90fd\u8981\u521b\u5efasecret \u81f3\u4e8esecret\u5982\u4f55\u521b\u5efa\u5c31\u4e0d\u5728\u6b64\u8d58\u8ff0\u4e86\uff0c\u7f51\u4e0a\u5f88\u591a\u53ef\u4ee5\u53c2\u8003\u7684\u8d44\u6599\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u9519\u8bef\u7684\u539f\u56e0\u5c31\u662f\u955c\u50cf\u62c9\u53d6\u5931\u8d25\uff0c\u5982\u4e0b\uff1a kubectl get pods -A -owide |grep jenk […]<\/p>\n","protected":false},"author":1479,"featured_media":142107,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-231312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/231312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=231312"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/231312\/revisions"}],"predecessor-version":[{"id":231316,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/231312\/revisions\/231316"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/142107"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=231312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=231312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=231312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}