Skip to content

Instantly share code, notes, and snippets.

@iammuho
Created April 14, 2024 14:22
Show Gist options
  • Save iammuho/a65272046f6014809c1d07890102c413 to your computer and use it in GitHub Desktop.
Save iammuho/a65272046f6014809c1d07890102c413 to your computer and use it in GitHub Desktop.
---
# Create the service account scoped to our `actions-runner-system` namespace
apiVersion: v1
kind: ServiceAccount
metadata:
name: gh-actions-deploy
namespace: actions-runner-system
secrets:
- name: gh-actions-deploy
---
# Create a role for it in that namespace
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gh-actions-deploy-full-access
namespace: actions-runner-system
rules:
- apiGroups: ["", "extensions", "apps"]
resources: ["*"]
verbs: ["*"]
- apiGroups: ["actions.github.com"]
resources: ["*"]
verbs: ["*"]
---
# Bind that service account to the role we created above
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gh-actions-deploy-full-access
namespace: actions-runner-system
subjects:
- kind: ServiceAccount
name: gh-actions-deploy
namespace: actions-runner-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: gh-actions-deploy-full-access
---
# Create the credential for us to use for deployment
apiVersion: v1
kind: Secret
metadata:
name: gh-actions-deploy
namespace: actions-runner-system
annotations:
kubernetes.io/service-account.name: gh-actions-deploy
type: kubernetes.io/service-account-token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment