For simulated Practice problems visit KillerCoda.
-
Solution
# file role.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: developer rules: - apiGroups: [""] resources: ["pods", "services"] verbs: ["*"] # using imperative command k create role developer --resource=pods,services --verb=*
-
Setup
# Step 1: Generate a private key and CSR openssl genrsa -out user.key 2048 openssl req -new -key user.key -out user.csr -subj "/CN=user/O=users" # Step 2: Sign the CSR with the Kubernetes CA # Assuming the Kubernetes CA files are located at /etc/kubernetes/pki/ openssl x509 -req -in user.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out user.crt -days 365
Solution
# create user k config set-credentials ardino --client-certificate=user.crt --client-key=user.key
-
Solution
# create user k create rolebinding developer-rolebinding --user=ardino --role=developer