Open y4h2 opened 2 years ago
Configure Service Accounts for Pods
如果什么都不配置,会默认使用Default ServiceAccount
通过annotation可以把secret绑定到service account上
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: build-robot-secret
annotations:
kubernetes.io/service-account.name: build-robot
type: kubernetes.io/service-account-token
EOF
在service account中可以配置image pull secrets
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2015-08-07T22:02:39Z
name: default
namespace: default
uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6
imagePullSecrets:
- name: myregistrykey
理解User Account和Service Account的区别
在Kubernetes中,ServiceAccount主要用于给Pod提供权限。
ServiceAccount可以和role通过RoleBinding绑定在一起