Kubernetes 设置图像缺少资源类型“部署" [英] Kubernetes set image missing resource type 'deployment'
问题描述
我正在尝试使用以下命令更新 Kubernetes 中的图像:
I'm trying to update an image in Kubernetes by using the following command:
kubectl set image deployment/ms-userservice ms-userservice=$DOCKER_REGISTRY_NAME/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT --insecure-skip-tls-verify
但是当我收到以下错误时:
But when I receive the following error:
error: the server doesn't have a resource type "deployment"
我已经检查过我在正确的命名空间中,并且具有该名称的 pod 存在并且正在运行.
I have checked that i am in the right namespace, and that the pod with the name exists and is running.
我找不到与此错误相关的任何有意义的资源.
I can't find any meaningful resources in regards to this error.
旁注:我是通过 Bitbucket 和管道来做这件事的,它也构建了我想要使用的图像.
Sidenote: I'm doing this through Bitbucket and a pipeline, which also builds the image i want to use.
有什么建议吗?
推荐答案
我已经通过将命名空间显式设置为参数来修复此错误,例如:
I've had this error fixed by explicitly setting the namespace as an argument, e.g.:
kubectl set image -n foonamespace deployment/ms-userservice.....
https://www.mankier.com/1/kubectl-set-image#--namespace
这篇关于Kubernetes 设置图像缺少资源类型“部署"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!