Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Generates self-signed tls secrets for kubernetes. Run this with e.g. 'kubernetes-gencerts microk8s.local', then install the secrets with 'kubectl apply -f microk8s.local.yaml'
openssl req -newkey rsa:2048 -nodes -keyout $HOSTNAME.key -x509 -days 3650 -out $HOSTNAME.crt
echo "apiVersion: v1
kind: Secret
name: $HOSTNAME.tls
namespace: default
tls.crt: `cat $HOSTNAME.crt | base64 -w0`
tls.key: `cat $HOSTNAME.key | base64 -w0`
" > $HOSTNAME.yaml

This comment has been minimized.

Copy link
Owner Author

@fauberso fauberso commented May 11, 2020

Thanks to Daniel Watrous' instructions ""Generate TLS Secret for kubernetes"" for this. FInd his article here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment