kubernetes-installation/rbac
2022-01-14 10:33:35 +07:00
..
.gitignore Add mysql cluster operator and rbac in sample 2022-01-14 10:33:35 +07:00
access.yaml Add mysql cluster operator and rbac in sample 2022-01-14 10:33:35 +07:00
README.md Add mysql cluster operator and rbac in sample 2022-01-14 10:33:35 +07:00

Create RBAC for specific namespace

  • Apply RBAC for specific namespace
k apply -f access.yaml
  • Get Details of RBAC
k describe sa developer -n developer-dev
  • Get Token from RBAC
k get secret developer-token-l4r67 -n developer-dev -o "jsonpath={.data.token}" | base64 -d
  • Get Certificate from RBAC
k get secret developer-token-l4r67 -n developer-dev -o "jsonpath={.data['ca\.crt']}"
  • Create kube config file
apiVersion: v1
kind: Config
preferences: {}
 cluster:
      certificate-authority-data: PLACE CERTIFICATE HERE
      server: https://YOUR_KUBERNETES_API_ENDPOINT
    name: developer-cluster

users:
  - name: developer
    user:
      as-user-extra: {}
      client-key-data: PLACE CERTIFICATE HERE
      token: PLACE USER TOKEN HERE

contexts:
  - context:
      cluster: kubernetes
      namespace: developer-dev
      user: developer
    name: developer-dev

current-context: developer-dev
clusters:
  - cluster:
      certificate-authority-data: PLACE CERTIFICATE HERE
      server: https://YOUR_KUBERNETES_API_ENDPOINT
    name: developer-cluster

users:
  - name: developer
    user:
      as-user-extra: {}
      client-key-data: PLACE CERTIFICATE HERE
      token: PLACE USER TOKEN HERE

contexts:
  - context:
      cluster: kubernetes
      namespace: developer-dev
      user: developer
    name: developer-dev

current-context: developer-dev