kubectl create secret tls

1 개요[ | ]

kubectl create secret tls
구문
kubectl create secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE}

2 실습[ | ]

$ CERT_NAME=tls-example
$ HOST=example.com
$ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout ${HOST}.key -out ${HOST}.crt -subj "/CN=${HOST}/O=${HOST}"
Generating a 2048 bit RSA private key
..............+++
............................+++
writing new private key to 'example.com.key'
-----
$ kubectl create secret tls ${CERT_NAME} --key ${HOST}.key --cert ${HOST}.crt
secret/tls-example created
$ ll ${HOST}*
-rw-r--r-- 1 root root 1159 May 26 13:50 example.com.crt
-rw-r--r-- 1 root root 1704 May 26 13:50 example.com.key
$ kubectl get secret ${CERT_NAME}
NAME          TYPE                DATA      AGE
tls-example   kubernetes.io/tls   2         28s
$ kubectl get secret ${CERT_NAME} -oyaml
apiVersion: v1
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURLekNDQWhPZ0F3SUJBZ0lKQVBPcE5EWnh1dHNETUEwR0NTcUdTSWIzRFFFQkN3VUFNQ3d4RkRBU0JnTlYKQkFNTUMyVjRZVzF3YkdVdVkyOXRNUlF3RWdZRFZRUUtEQXRsZUdGdGNHeGxMbU52YlRBZUZ3MHhPVEExTWpZeApNelV3TURaYUZ3MHlPVEExTWpNeE16VXdNRFphTUN3eEZEQVNCZ05WQkFNTUMyVjRZVzF3YkdVdVkyOXRNUlF3CkVnWURWUVFLREF0bGVHRnRjR3hsTG1OdmJUQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0MKZ2dFQkFNeEQwdU41MXJQK0FWNXlxdWlza2ZiV1FPT2drRnV4TzVmcHg1TU14VjJQR29xZy93NS9rN1VuVFdGbwo3RVJFc251UFg3S29QajRCWkdtcURtamNXM01HTUx6akNrcnlqdEkvU2orTGowK0tnL3lmajdCbzlQS0RHenBwCmVEcFpmK2JEblRrS2ZjWWtLaEo4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BDV05rbmxidU9PRUVMCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
kind: Secret
metadata:
  creationTimestamp: 2019-05-26T13:50:26Z
  name: tls-example
  namespace: default
  resourceVersion: "30006"
  selfLink: /api/v1/namespaces/default/secrets/tls-example
  uid: 3766eba9-7fbd-11e9-8e45-0242ac11000f
type: kubernetes.io/tls

3 같이 보기[ | ]

4 참고[ | ]

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