Skip to content

Instantly share code, notes, and snippets.

@jengo
Created June 6, 2017 08:39
Show Gist options
  • Save jengo/4d4257258c10db6ade8bd819c0d30796 to your computer and use it in GitHub Desktop.
Save jengo/4d4257258c10db6ade8bd819c0d30796 to your computer and use it in GitHub Desktop.
Generate self signed TLS / SSL certificate as a Kubernetes secret
export HOSTNAME=localhost
export NAMESPACE=default
export SECRET_NAME=test-ssl-secret
openssl req -x509 -nodes -days 365 -sha256 -newkey rsa:2048 -keyout /tmp/tls.key -out /tmp/tls.crt -subj "/CN=${HOSTNAME}/"
kubectl --namespace ${NAMESPACE} create secret tls ${SECRET_NAME} --key /tmp/tls.key --cert /tmp/tls.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment