User permission problem


#1

I have configured user permissions on the current system account, and updated .kube/config, which can prompt me or anonymous requests when I perform some operations. The details are as follows:
[root@ops-k8s-master1 k8s]# kubectl config view
apiVersion: v1
clusters:

  • cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://192.168.5.184:6443
    name: kubernetes
    contexts:
  • context:
    cluster: kubernetes
    namespace: test-ops
    user: ops
    name: kubernetes
    current-context: kubernetes
    kind: Config
    preferences: {}
    users:
  • name: ops
    user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
    [root@ops-k8s-master1 k8s]# kubectl create -f nginx.yaml
    pod/nginx-latest created
    [root@ops-k8s-master1 k8s]# kubectl logs nginx-latest -n test-ops
    Error from server (Forbidden): Forbidden (user=system:anonymous, verb=get, resource=nodes, subresource=proxy) ( pods/log nginx-latest)
    [root@ops-k8s-master1 k8s]#