AWS Kubernetes Service Account Creation
- Log into the Kubernetes cluster using CLI command line.
- Create a service account yaml file. (e.g. serviceaccount.yaml)
- Copy and paste the following configurations to the yaml file:
- Save the yaml file.
- Apply the service account yaml file with the following command:
apiVersion: v1
apiVersion: v1
kind: ServiceAccount
metadata:
name: auto-deployment-sa
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: auto-deployment-role
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: auto-deployment-rolebinding
subjects:
- kind: ServiceAccount
name: auto-deployment-sa
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: auto-deployment-role
kubectl apply -f "service account file name"