kubectl create secret

1 개요[ | ]

kubectl create secret
localhost:~$ kubectl create secret generic mysql --from-literal=password=root
secret/mysql created
localhost:~$ kubectl get secret mysql
NAME    TYPE     DATA   AGE
mysql   Opaque   1      9s
localhost:~$ kubectl get secret mysql -oyaml
apiVersion: v1
data:
  password: cm9vdA==
kind: Secret
metadata:
  creationTimestamp: "2019-05-29T05:15:09Z"
  name: mysql
  namespace: default
  resourceVersion: "498655"
  selfLink: /api/v1/namespaces/default/secrets/mysql
  uid: ba82d526-81d0-11e9-93b4-0a2cc19750f8
type: Opaque
localhost:~$ kubectl delete secret mysql
secret "mysql" deleted

2 실습[ | ]

$ echo -n 'admin' > ./username.txt
$ echo -n '1f2d1e2e67df' > ./password.txt
$ kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt
secret/db-user-pass created
$ kubectl get secret db-user-pass -oyaml | grep ^data: -A2
data:
  password.txt: MWYyZDFlMmU2N2Rm
  username.txt: YWRtaW4=

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}