kubernetes.io > Documentation > Reference > kubectl CLI > kubectl Cheat Sheet
kubernetes.io > Documentation > Tasks > Monitoring, Logging, and Debugging > Get a Shell to a Running Container
kubernetes.io > Documentation > Tasks > Access Applications in a Cluster > Configure Access to Multiple Clusters
kubernetes.io > Documentation > Tasks > Access Applications in a Cluster > Accessing Clusters using API
kubernetes.io > Documentation > Tasks > Access Applications in a Cluster > Use Port Forwarding to Access Applications in a Cluster
show
# create a file named role.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "watch", "list"]
# create the role
kubectl apply -f role.yml
# or imperatively
kubectl -n default create role pod-reader --verb=get,watch,list --resource=pods,pods/logs
show
# create a file named role-binding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-reader
namespace: default
subjects:
- kind: User
name: dev
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io
# or imperatively
kubectl -n default create rolebinding pod-reader --role=pod-reader --user=dev