我已经用kubeadm
和docker 18.09.4
安装了K8S,它工作正常。然后,我安装了gcloud
,运行了gcloud init
,然后选择了已激活gcr
的项目,接着是gcloud components install kubectl docker-credentials-gcr
,接着是docker-credentials-gcr configure-docker
。
在那个阶段,docker
可以从我自己的gcr
注册表中提取图像,而kubelet
不能。
基本上,如果我运行docker run --rm --name hello gcr.io/own-gcr/hello-world
,它将从注册表中提取图像并启动容器。
如果我从本地注册表中删除该映像并运行``,它将失败并显示以下说明:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 23s default-scheduler Successfully assigned default/node-hello-6b99957775-9dvvw to lfr025922-docker
Normal BackOff 20s (x2 over 21s) kubelet, lfr025922-docker Back-off pulling image "gcr.io/own-gcr/node-hello"
Warning Failed 20s (x2 over 21s) kubelet, lfr025922-docker Error: ImagePullBackOff
Normal Pulling 9s (x2 over 22s) kubelet, lfr025922-docker Pulling image "gcr.io/own-gcr/node-hello"
Warning Failed 9s (x2 over 21s) kubelet, lfr025922-docker Failed to pull image "gcr.io/own-gcr/node-hello": rpc error: code = Unknown desc = Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
Warning Failed 9s (x2 over 21s) kubelet, lfr025922-docker Error: ErrImagePull
我当然遵循https://cloud.google.com/container-registry/docs/advanced-authentication页上的所有说明,但没有一个成功。
您是否知道kubelet 1.14
和docker 18.09.5
的任何问题? kubelet
是否不应该依赖底层的CRI
(此处为docker
)?您是否知道可能导致该问题的原因?
答案 0 :(得分:2)
@VasilyAngapov是真的。
我遵循了https://container-solutions.com/using-google-container-registry-with-kubernetes/此处提供的技巧,并且效果很好(将访问令牌与with cte_get_cats AS
(
select id,
val as category_list
from staging.par.test_json
),
cats_parse AS
(
select id,
parse_json(category_list) as c
from cte_get_cats
),
distinct_cats as
(
select id,
MIN(INDEX) AS index,
UPPER(cast(value:element AS varchar)) As c
from
cats_parse,
LATERAL flatten(INPUT => c:"list")
group by 1,3
) ,
cat_array AS
(
SELECT
id,
array_agg(c) within group (order by index) AS sds_categories
FROM
distinct_cats
GROUP BY 1
),
sds_cats AS
(
select id,
cast(sds_categories[0] AS varchar) as sds_primary_category
from cat_array
)
select * from cat_array;
一起使用)
非常感谢。