CKA考试题[Secret]
创建一个secret,使用以下:
名字:super-secret
credential:bob
创建一个pod名为pod-secrets-via-file 使用redis镜像,挂载名为super-secret的 挂载路径/secrets
使用redis镜像创建第二个Pod名称Pod-secrets-via-env, 导出为 CREDENTIALS
解答:
(1).创建secret(https://kubernetes.io/docs/concepts/configuration/secret/)
kubectl create secret generic super-secret --from-literal=credential=bob
对应的yaml
apiVersion: v1 data: credential: Ym9i kind: Secret metadata: creationTimestamp: null name: super-secret
(2).创建pod-secrets-via-file (https://kubernetes.io/docs/concepts/configuration/secret/)
apiVersion: v1 kind: Pod metadata: name: pod-secrets-via-file spec: containers: - name: mypod image: redis volumeMounts: - name: foo mountPath: "/secrets" readOnly: true volumes: - name: foo secret: secretName: super-secret
(3).Pod-secrets-via-env (https://kubernetes.io/docs/concepts/configuration/secret/)
apiVersion: v1 kind: Pod metadata: name: Pod-secrets-via-env spec: containers: - name: mycontainer image: redis env: - name: CREDENTIALS valueFrom: secretKeyRef: name: super-secret key: credential
相关推荐
朱培知浅ZLH 2020-11-16
cdbdqn00 2020-11-12
达观数据 2020-11-11
JustinChia 2020-11-11
远远的山 2020-11-09
jingtao 2020-11-08
大叔比较胖 2020-10-30
gracecxj 2020-10-30
onepiecedn 2020-10-29
kunyus 2020-10-28
JustHaveTry 2020-10-27
锋锋 2020-10-26
hubanbei00的家园 2020-10-25
谢恩铭 2020-10-23
btqszl 2020-10-21
kaidiphp 2020-10-13
guchengxinfen 2020-10-12
liverlife 2020-10-10
BigDataMining 2020-10-08