kubectl create serviceaccount myserviceaccount
kubectl get sa
kubectl describe sa myserviceaccount
kubectl describe secret [secret]
** Example:1 **
vi my-sa.yaml
apiVersion: v1
kind: Pod
metadata:
name: my-sa-pod
spec:
serviceAccountName: myserviceaccount
containers:
name: my-sa-container
image: busybox
command: ['sh', '-c', "echo Hello, Kubernetes! && sleep 3600"]
kubectl create -f my-sa.yaml
kubectl get pods my-sa-pod -o yaml
kubectl exec my-sa-pod -- ls /var/run/secrets/kubernetes.io/serviceaccount
kubectl exec my-sa-pod -- cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt