allow access to all resources on kubernetes cluster except get nodes

user10724620

Team, I have below cluster role on kubernetes that allows access to everything but I wan't to restrict node level commands and allow all rest.

What to modify below? Basically, user should be able to run

kubectl get all --all-namespaces

but not nodes info should NOT display

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
  labels:
    kubernetes.io/bootstrapping: rbac-defaults
  name: cluster-admin-test
rules: 
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
A_Suh

Rules are purely additive, means that you cannot restrict rules.

Thus, you will need to list all accessible resources, but "nodes" with appropriate operations

For example:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
  labels:
    kubernetes.io/bootstrapping: rbac-defaults
  name: cluster-admin
rules: 
- apiGroups: [""] 
  resources: ["pods","services","namespaces","deployments","jobs"] 
  verbs: ["get", "watch", "list"]

Also, it is highly not recommended to change cluster-admin role. It is worth to create a new role and assign users to it.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to find available resources in a Kubernetes Cluster level?

分類Dev

Why should a production Kubernetes cluster have a minimum of three nodes?

分類Dev

Why are there 3 nodes in a default Google Kubernetes Engine cluster?

分類Dev

Why are there 3 nodes in a default Google Kubernetes Engine cluster?

分類Dev

Kubernetes: Nodes/Pods not showing with kubectl after building cluster with kubeadm

分類Dev

Nokogiri get all HTML nodes

分類Dev

Cassandra configuration - is native transport necessary on all cluster nodes?

分類Dev

Configure kubectl command to access remote kubernetes cluster on azure

分類Dev

Configure kubectl command to access remote kubernetes cluster on azure

分類Dev

Configure kubectl command to access remote kubernetes cluster on azure

分類Dev

C# Get all nodes in xml document but ignoring nested nodes

分類Dev

I want to ping (icmp) monitor the worker nodes that make up the kubernetes cluster without using the internal IP of the node

分類Dev

Accidentally drained all nodes in Kubernetes (even master). How can I bring my Kubernetes back?

分類Dev

VPN to access cluster services / pods : cannot ping anything except openvpn server

分類Dev

How to get all Kubernetes Deployment objects using kubernetes java client?

分類Dev

How to add to all responses 'Access-Control-Allow-Origin' header?

分類Dev

elixir - how to get all elements except last in the list?

分類Dev

Get all children of a SilverStripe page except those of a certain page type

分類Dev

Get all pods except the pods inside kube-system

分類Dev

How i can get all products except duplicates?

分類Dev

Get sum of all DOM nodes having same class with JavaScript or jQuery

分類Dev

Get xpath of all nodes in XML tree with attributes - Python

分類Dev

Trying to get all nodes with at least 2 incoming connections

分類Dev

Instagram api get JavaScript Access-Control-Allow-Origin

分類Dev

How to auto scale on Kubernetes (GKE) with a pod that runs one per node and uses all available resources?

分類Dev

Reset Kubernetes cluster

分類Dev

How to get the available resources (memory, cpu) in a K8s cluster?

分類Dev

express + socket.io + kubernetes Access-Control-Allow-Origin 'ヘッダー

分類Dev

Kubernetes - How to access nginx load balancing from outside the cluster using a NodePort service

Related 関連記事

  1. 1

    How to find available resources in a Kubernetes Cluster level?

  2. 2

    Why should a production Kubernetes cluster have a minimum of three nodes?

  3. 3

    Why are there 3 nodes in a default Google Kubernetes Engine cluster?

  4. 4

    Why are there 3 nodes in a default Google Kubernetes Engine cluster?

  5. 5

    Kubernetes: Nodes/Pods not showing with kubectl after building cluster with kubeadm

  6. 6

    Nokogiri get all HTML nodes

  7. 7

    Cassandra configuration - is native transport necessary on all cluster nodes?

  8. 8

    Configure kubectl command to access remote kubernetes cluster on azure

  9. 9

    Configure kubectl command to access remote kubernetes cluster on azure

  10. 10

    Configure kubectl command to access remote kubernetes cluster on azure

  11. 11

    C# Get all nodes in xml document but ignoring nested nodes

  12. 12

    I want to ping (icmp) monitor the worker nodes that make up the kubernetes cluster without using the internal IP of the node

  13. 13

    Accidentally drained all nodes in Kubernetes (even master). How can I bring my Kubernetes back?

  14. 14

    VPN to access cluster services / pods : cannot ping anything except openvpn server

  15. 15

    How to get all Kubernetes Deployment objects using kubernetes java client?

  16. 16

    How to add to all responses 'Access-Control-Allow-Origin' header?

  17. 17

    elixir - how to get all elements except last in the list?

  18. 18

    Get all children of a SilverStripe page except those of a certain page type

  19. 19

    Get all pods except the pods inside kube-system

  20. 20

    How i can get all products except duplicates?

  21. 21

    Get sum of all DOM nodes having same class with JavaScript or jQuery

  22. 22

    Get xpath of all nodes in XML tree with attributes - Python

  23. 23

    Trying to get all nodes with at least 2 incoming connections

  24. 24

    Instagram api get JavaScript Access-Control-Allow-Origin

  25. 25

    How to auto scale on Kubernetes (GKE) with a pod that runs one per node and uses all available resources?

  26. 26

    Reset Kubernetes cluster

  27. 27

    How to get the available resources (memory, cpu) in a K8s cluster?

  28. 28

    express + socket.io + kubernetes Access-Control-Allow-Origin 'ヘッダー

  29. 29

    Kubernetes - How to access nginx load balancing from outside the cluster using a NodePort service

ホットタグ

アーカイブ