User Tools

Site Tools


kubernetes

Kubernetes

Creating user accounts and workspace binding

commands

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']}"

Config

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
kubernetes.txt · Last modified: 2020/08/10 02:35 (external edit)