This shows you the differences between two versions of the page.
kubernetes [2019/05/03 20:18] k2patel [Config] |
kubernetes [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Kubernetes ====== | ||
- | ==== Creating user accounts and workspace binding ==== | ||
- | === commands === | ||
- | |||
- | <code bash> | ||
- | kubectl create namespace gitlab-test-k2 | ||
- | kubectl config set-context $(kubectl config current-context) --namespace=gitlab-test-k2 | ||
- | kubectl apply -f gitlab-service-accnt.yaml | ||
- | kubectl describe sa gitlab-k2 -n gitlab-test-k2 | ||
- | kubectl get secret gitlab-k2-token-2nrjl -n gitlab-test-k2 -o "jsonpath={.data.token}" | base64 -D | ||
- | kubectl get secret gitlab-k2-token-2nrjl -n gitlab-test-k2 -o "jsonpath={.data['ca\.crt']}" | ||
- | </code> | ||
- | |||
- | ==== Config ==== | ||
- | <code yaml gitlab-service-accnt.yaml> | ||
- | --- | ||
- | apiVersion: v1 | ||
- | kind: ServiceAccount | ||
- | metadata: | ||
- | name: gitlab-k2 | ||
- | namespace: gitlab-test-k2 | ||
- | --- | ||
- | kind: Role | ||
- | apiVersion: rbac.authorization.k8s.io/v1 | ||
- | metadata: | ||
- | namespace: gitlab-test-k2 | ||
- | name: gitlab-k2 | ||
- | rules: | ||
- | - apiGroups: [""] | ||
- | resources: ["*"] | ||
- | verbs: ["*"] | ||
- | --- | ||
- | kind: RoleBinding | ||
- | apiVersion: rbac.authorization.k8s.io/v1 | ||
- | metadata: | ||
- | name: gitlab-k2 | ||
- | namespace: gitlab-test-k2 | ||
- | subjects: | ||
- | - kind: ServiceAccount | ||
- | name: gitlab-k2 | ||
- | namespace: gitlab-test-k2 | ||
- | roleRef: | ||
- | kind: Role | ||
- | name: gitlab-k2 | ||
- | apiGroup: rbac.authorization.k8s.io | ||
- | </code> | ||