Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to control access for pods/exec only in kubernetes rbac without pods create binded?

Tags:

I checked the kubernetes docs, find that pods/exec resources has no verb, and do not know how to only control access for it? Since I create a pod, someone else need to access it use 'exec' but cannot create anything in my cluster.

How to implement this?

like image 208
peteyuan Avatar asked Nov 24 '17 07:11

peteyuan


People also ask

What is the technique used to prevent user access to a Kubernetes namespace?

An easy to grasp anti-pattern for Kubernetes namespaces is versioning. You should not use Namespaces as a way to disambiguate versions of your Kubernetes resources. Support for versioning is present in the containers and container registries as well as in Kubernetes Deployment resource.

What are the three elements of role based access control in Kubernetes?

There are three types of entities in Kubernetes: a user (which is usually a human), a group (which is usually a set of humans), and a service account (which is used by pods inside the cluster).


1 Answers

Since pods/exec is a subresource of pods, If you want to exec a pod, you first need to get the pod, so here is my role definition.

kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  namespace: default
  name: pod-reader
rules:
- apiGroups: [""]
  resources: ["pods", "pods/log"]
  verbs: ["get", "list"]
- apiGroups: [""]
  resources: ["pods/exec"]
  verbs: ["create"]
like image 104
peteyuan Avatar answered Sep 22 '22 12:09

peteyuan