Bring your own Wildcard Certificate
Okteto can use your own wildcard certificate. You need the certificate's private and public keys. The certificate must be a PEM-encoded X.509 certificate with *.SUBDOMAIN as its Subject Alternative Name. The private key can be PEM-encoded PKCS#1 (BEGIN RSA PRIVATE KEY), SEC1 (BEGIN EC PRIVATE KEY), or, starting with Okteto 1.48, PKCS#8 (BEGIN PRIVATE KEY).
Import the secret into your kubernetes cluster by running the command below:
kubectl create secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE} --namespace okteto
In this example, CERT_NAME is your-ssl-certificate-secret.
After you create the secret, add the following to your Helm configuration file to tell Okteto and NGINX to use your certificate:
wildcardCertificate:
create: false
name: your-ssl-certificate-secret
ingress-nginx:
controller:
extraArgs:
default-ssl-certificate: $(POD_NAMESPACE)/your-ssl-certificate-secret
You can use any certificate provider that issues X.509 certificates. For example, the Okteto community maintains a guide to configure your certificate with GoDaddy.
Upgrade your Okteto installation to apply the new configuration.
If publicOverride is set, the certificate's Subject Alternative Name list must include its value too. For example, if you use dev.example.com as the publicOverride and okteto.net as the subdomain, generate a certificate that includes *.okteto.net and dev.example.com in the Subject Alternative Name list.
Bring your own Certificate Authority
By default, Okteto trusts certificates issued by any well-known certificate authority. If your certificate is self-signed, or issued by a new or private certificate authority, import your certificate authority's public key.
First import your certificate authority by running the command below:
kubectl create secret generic ${CA_NAME} --from-file=ca.crt=${CA_FILE} --namespace okteto
In this example, CA_NAME is your-ca-secret.
After you create the secret, add the following to your Helm configuration file to tell Okteto to use your certificate authority:
wildcardCertificate:
create: false
name: your-ssl-certificate-secret
privateCA:
enabled: true
secret:
name: your-ca-secret
key: ca.crt
ingress-nginx:
controller:
extraArgs:
default-ssl-certificate: $(POD_NAMESPACE)/your-ssl-certificate-secret
Upgrade your Okteto instance to apply the new configuration. Upgrade to the same version you already run: it keeps the changes to a minimum and makes any issue easier to troubleshoot.
Injecting the CA into cluster nodes
When you enable privateCA, the Okteto daemonset installs the CA into each node's trust store by default, so the kubelet can pull images from the Okteto Registry. For containerd to trust the new CA, the daemonset restarts it once on each node. This restart interrupts any image pulls in progress and can restart the containers already running on that node.
To avoid this restart, set daemonset.injectCA.enabled to false so the daemonset no longer touches the nodes' trust store. With injection disabled, you're responsible for adding the CA to every node's trust store yourself. If a node doesn't trust the CA, image pulls from the Okteto Registry fail with a certificate verification error.
Your cloud provider's documentation explains how to add the CA to the nodes' trust store:
- Google Kubernetes Engine (GKE): Access private registries with private CA certificates.
- Azure Kubernetes Service (AKS): Custom certificate authority.
- Amazon Elastic Kubernetes Service (EKS): Use private certificates to enable a container repository in Amazon EKS.