Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cert2secret with all npm packages installed. Try it out:

var cert2secret = require("cert2secret")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cert2secret v0.0.1

Turn your TLS certificates into a Kubernetes TLS secret manifest.


Easily generate a Kubernetes TLS secret manifest from a TLS key/certificate pair.

Use case: you want to secure an Ingress specifying a secret containing the TLS key/cert pair.

NOTE: If your goal it's just to create a tls secret in a cluster you can use kubectl instead.

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


npm install -g cert2secret


Usage: cert2secret [options]

  -V, --version                  output the version number
  -k, --key <key file>           you must specify a TLS key file
  -c, --cert <certificate file>  you must specify a TLS certificate file
  -d --dest <destination>        destination for the generated yaml manifest
  --secretname <secretname>      the name of your certificate used in the secret metadata
  --namespace <namespace>        the namespace for your certificate manifest
  -h, --help                     output usage information


cert2secret -k your-certificate.key -c your-certificate.crt -d ./certificate-manifest.yaml

The command above will generate a file called certificate-manifest.yml with the following content:

apiVersion: v1
kind: Secret
  namespace: default
  tls.crt: >-
    ...base64 encoded certificate data
  tls.key: >-
    ...base64 encoded key data
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free