What Is a kubernetes.io/tls Secret?
A kubernetes.io/tls Secret is the built-in Kubernetes Secret type that stores a TLS certificate and private key for Ingress and for workloads that mount the Secret. The type requires two data keys: tls.crt (PEM certificate, which may include the chain) and tls.key (PEM private key). For mTLS you can add ca.crt, the issuing CA with the leaf certificate removed. Extra data keys are allowed; ca.crt is not required by the type.
Why use OneClickTLS for Kubernetes TLS Secrets?
The output is ready to use. It fits development, test, and home-lab clusters. You do not need to run openssl to create the key and certificate, save those files, and then pass their paths to kubectl create secret tls.
kubectl create secret tls creates the same kubernetes.io/tls Secret, but the PEM files must already be on disk and you need access to the cluster. OneClickTLS gives you paste-ready Secret YAML, that kubectl one-liner, an Ingress spec.tls snippet, and the mTLS CA (ca.crt) in one step.
Use it for dev and test. For production, use cert-manager or your own PKI.
Apply the generated Secret
Both results contain the same tls.crt and tls.key. kubectl apply -f needs only the YAML. The kubectl create secret tls one-liner is the command that needs the PEM files saved on your machine.
kubectl apply -f secret.yaml
Or use the same one-liner this page prints. It does not write ca.crt. kubectl create fails if that Secret name already exists; use the YAML in that case.
kubectl create secret tls NAME --cert=tls.crt --key=tls.key -n NS
Reference the Secret from Ingress
A standard Ingress, including ingress-nginx and Traefik's Kubernetes Ingress provider, uses spec.tls. The Secret must be in the same namespace as the Ingress, and hosts should match the certificate SANs.
spec:
tls:
- hosts:
- app.example.com
secretName: app-example-com-tls
A Traefik IngressRoute CRD uses spec.tls.secretName instead. That Secret must also be in the same namespace as the IngressRoute.
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
spec:
tls:
secretName: app-example-com-tls
mTLS client Secrets
The server Secret supplies tls.crt and tls.key for Ingress. A client workload can mount the client Secret (often named {cn}-client-tls) and read tls.crt, tls.key, and ca.crt when that key is present. ingress-nginx client-certificate authentication is different: the annotation nginx.ingress.kubernetes.io/auth-tls-secret points at a Secret that contains ca.crt (the CA used to verify clients, not the client private key). Pair it with nginx.ingress.kubernetes.io/auth-tls-verify-client: "on". The annotation value is namespace/secret-name.
Do not commit the private key
tls.key in the Secret YAML is base64-encoded, not encrypted. Anyone who can read the file can recover the private key. Do not commit it to git unless you wrap it with Sealed Secrets, SOPS, or External Secrets. The generate API creates the certificate in memory and returns the PEM. It does not save the certificate or private key. It does record the client IP, the generator type, and the domain or SAN names in the admin activity log. A logged-in certificate template stores the form fields you save, such as the common name and SANs, not the generated key. The Secret YAML is built in your browser and is not uploaded.
Frequently asked questions
Does kubectl create secret tls match the YAML?
For tls.crt and tls.key, yes, when the local PEM files are the ones you generated. The command does not write ca.crt. When you need the CA, kubectl apply -f the YAML.
Is the private key encrypted in the Secret YAML?
No. Base64 is encoding, not encryption. Cluster encryption of Secrets in etcd does not protect the YAML file you downloaded.
Does OneClickTLS store the Kubernetes Secret?
No. The Secret YAML is built in your browser and is not uploaded. The generate API does not save the certificate or private key. It does record your IP, the request type, and the domain or SAN names. A logged-in certificate template stores form fields, not the generated key.