Less than 1 minute
apiVersion: v1
kind: Pod
metadata:
name: nginx-sa-longtime
labels:
app: nginx
spec:
# automountServiceAccountToken: true # 默认true,token会自动挂载到 /var/run/secrets/kubernetes.io/serviceaccount/token
serviceAccountName: sa1
containers:
- name: nginx-container
image: nginx
# 启用下面的配置来自定义映射
# volumeMounts:
# - mountPath: /var/run/secrets/kubernetes.io/serviceaccount/
# name: token
# volumes:
# - name: token
# projected:
# sources:
# - serviceAccountToken:
# path: token
# expirationSeconds: 600
# audience: vault