Kubernetes Service Account Operations: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Kubernetes Operations#Subjects|Kubernetes Operations]] | * [[Kubernetes Operations#Subjects|Kubernetes Operations]] | ||
* [[Kubernetes Security Operations]] | |||
* [[Kubernetes_Security_Concepts#Service_Account|Kubernetes Security Concepts]] | |||
=Create a Service Account= | =Create a Service Account= | ||
==With CLI== | |||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
kubectl create serviceaccount -n <namespace> <service-account-name> | kubectl create serviceaccount -n <namespace> <service-account-name> | ||
kubectl create serviceaccount -n blue blue-serviceaccount | kubectl create serviceaccount -n blue blue-serviceaccount | ||
</syntaxhighlight> | </syntaxhighlight> | ||
It automatically creates the secret. | |||
===With Metadata=== | |||
<syntaxhighlight lang='yaml'> | |||
apiVersion: v1 | |||
kind: ServiceAccount | |||
metadata: | |||
name: example-sa | |||
</syntaxhighlight> | |||
It automatically creates the secret. | |||
=Details about the Namespace's Default Service Account= | =Details about the Namespace's Default Service Account= | ||
<syntaxhighlight lang='bash'> | |||
kubectl -n <namespace> -o yaml get sa default | |||
</syntaxhighlight> | |||
=Deploy a Service Account, a Role and a Role Binding with a Helm Chart= | |||
{{External|https://github.com/ovidiuf/playground/tree/master/helm/service-account-and-roles}} |
Latest revision as of 17:51, 3 May 2021
Internal
Create a Service Account
With CLI
kubectl create serviceaccount -n <namespace> <service-account-name>
kubectl create serviceaccount -n blue blue-serviceaccount
It automatically creates the secret.
With Metadata
apiVersion: v1
kind: ServiceAccount
metadata:
name: example-sa
It automatically creates the secret.
Details about the Namespace's Default Service Account
kubectl -n <namespace> -o yaml get sa default