Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create TLS key and cert without CA
  • Create keys
openssl req -newkey rsa:2048 -nodes -keyout tls.key -x509 -days 365 -out tls.crt -subj "/CN=localhost"
  • Create environment variables
TLS_KEY=$(cat tls.key | base64 | tr -d '\n')
TLS_CRT=$(cat tls.crt | base64 | tr -d '\n')
echo $TLS_KEY
echo $TLS_CRT
  • Copy/paste contents of TLS_KEY and TLS_CERT into your Secret YAML.
apiVersion: v1
kind: Secret
metadata:
  name: keycloak-tls-secret
type: kubernetes.io/tls
data:
  tls.key: COPIED_TLS_KEY_CONTENT_HERE
  tls.crt: COPIED_TLS_CRT_CONTENT_HERE
  • Create Secret with: kubectl apply -f FILE_NAME.yaml -n YOUR_NAMESPACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment