Skip to content

Instantly share code, notes, and snippets.

@peerapach
Created December 31, 2018 07:44
Show Gist options
  • Save peerapach/6fc08a43346376cd9f9fefcfe1e9397e to your computer and use it in GitHub Desktop.
Save peerapach/6fc08a43346376cd9f9fefcfe1e9397e to your computer and use it in GitHub Desktop.
gitlab service account for gitlab integration with kubernetes
apiVersion: v1
kind: Namespace
metadata:
name: gitlab-managed-apps
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-sa
namespace: gitlab-managed-apps
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: gitlab-role
namespace: gitlab-managed-apps
rules:
- apiGroups:
- ""
- extensions
resources:
- '*'
verbs:
- '*'
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: gitlab-rb
namespace: gitlab-managed-apps
subjects:
- kind: ServiceAccount
name: gitlab-sa
namespace: gitlab-managed-apps
roleRef:
kind: Role
name: gitlab-role
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: gitlab-cluster
namespace: gitlab-managed-apps
subjects:
- kind: ServiceAccount
name: default
namespace: gitlab-managed-apps
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-cluster-admin
subjects:
- kind: ServiceAccount
name: gitlab-sa
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: Secret
metadata:
name: gitlab-secret
namespace: gitlab-managed-apps
annotations:
kubernetes.io/service-account.name: gitlab-sa
type: kubernetes.io/service-account-token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment