我有服务帐户名:myservice
$ kubectl get serviceaccount
NAME SECRETS AGE
default 1 15d
myservice 1 15d
$ kubectl get serviceaccount myservice -o yaml
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2018-06-13T12:41:18Z
name: myservice
namespace: default
...
我想将服务的命名空间default
更改为development
。
我尝试使用以下内容进行编辑:
kubectl edit serviceaccount myservice
保存后,我收到:
A copy of your changes has been stored to "/tmp/kubectl-edit-gjae6.yaml"
error: the namespace from the provided object "development" does not match the namespace "default". You must pass '--namespace=development' to perform this operation.
所以我尝试像他们写的那样,但是仍然没有用:
$ kubectl edit serviceaccount myservice --namespace=development
Error from server (NotFound): serviceaccounts "myservice" not found
名称空间development
存在,服务myservice
也存在。
答案 0 :(得分:2)
似乎您应该在开发NS中创建新的myservice SA,而不是修改默认名称空间中的现有SA。在开发NS中创建新的myservice,然后在默认NS中删除一个。该错误甚至在开发NS中也导致不存在的myservice。