Internal TLS
This page helps you encrypt the admin console’s and the gateway’s connections to the auth server.
Start with Gateway and certificates or Routing. Keep these patches beside the wizard’s goiabada-k8s.yaml. The first section applies under every routing mode; the second only where the manifest writes HTTPRoutes, to a Gateway of its own or someone else’s.
Admin console to auth server
Section titled “Admin console to auth server”This example uses cert-manager’s CA issuer, with your authority’s certificate in ca.pem and signing key in ca-key.pem. With an existing issuer, skip the signing Secret and Issuer below and set the Certificate’s issuerRef to yours.
-
Issue the auth server’s certificate. Import the authority into the namespace:
Terminal window kubectl create secret tls goiabada-internal-ca -n goiabada \--cert=ca.pem --key=ca-key.pemSave this as
internal-certificate.yaml. Replacegoiabadaandcluster.localthroughout these files if your namespace or cluster DNS domain differs.apiVersion: cert-manager.io/v1kind: Issuermetadata:name: goiabada-internal-canamespace: goiabadaspec:ca:secretName: goiabada-internal-ca---apiVersion: cert-manager.io/v1kind: Certificatemetadata:name: goiabada-authserver-internalnamespace: goiabadaspec:secretName: goiabada-authserver-internaldnsNames:- goiabada-authserver- goiabada-authserver.goiabada.svc.cluster.localissuerRef:name: goiabada-internal-cakind: IssuerTerminal window kubectl apply -f internal-certificate.yamlkubectl wait -n goiabada --for=condition=Ready \certificate/goiabada-authserver-internal --timeout=2m -
Share the public certificate. Use the key
ca.crt, which the gateway requires too:Terminal window kubectl create configmap goiabada-internal-ca -n goiabada \--from-file=ca.crt=ca.pem --dry-run=client -o yaml > internal-ca.yamlkubectl apply -f internal-ca.yaml -
Mount the files and turn on HTTPS. Save these patches as
internal-tls-patches.yaml:apiVersion: v1kind: ConfigMapmetadata:name: goiabada-authserver-confignamespace: goiabadadata:GOIABADA_AUTHSERVER_CERTFILE: "/etc/goiabada/internal-tls/tls.crt"GOIABADA_AUTHSERVER_KEYFILE: "/etc/goiabada/internal-tls/tls.key"GOIABADA_AUTHSERVER_LISTEN_PORT_HTTPS: "9443"---apiVersion: v1kind: ConfigMapmetadata:name: goiabada-adminconsole-confignamespace: goiabadadata:GOIABADA_AUTHSERVER_INTERNALBASEURL: "https://goiabada-authserver:9443"GOIABADA_ADMINCONSOLE_INTERNAL_CA_FILE: "/etc/goiabada/internal-ca/ca.crt"---apiVersion: apps/v1kind: Deploymentmetadata:name: goiabada-authservernamespace: goiabadaspec:template:spec:containers:- name: authserverports:- name: httpscontainerPort: 9443volumeMounts:- name: internal-tlsmountPath: /etc/goiabada/internal-tlsreadOnly: truevolumes:- name: internal-tlssecret:secretName: goiabada-authserver-internal---apiVersion: apps/v1kind: Deploymentmetadata:name: goiabada-adminconsolenamespace: goiabadaspec:template:spec:containers:- name: adminconsolevolumeMounts:- name: internal-camountPath: /etc/goiabada/internal-careadOnly: truevolumes:- name: internal-caconfigMap:name: goiabada-internal-ca---apiVersion: v1kind: Servicemetadata:name: goiabada-authservernamespace: goiabadaspec:ports:- name: httpsport: 9443targetPort: 9443The patch adds the
httpsport beside the manifest’shttpone, 9090, which the gateway calls until the next section. -
Apply the patches. Save this as
kustomization.yaml. Omit the final patch if you generated no NetworkPolicies.apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationresources:- goiabada-k8s.yamlpatches:- path: internal-tls-patches.yaml- target:kind: NetworkPolicyname: goiabada-authserverpatch: |-- op: addpath: /spec/ingress/0/ports/-value:protocol: TCPport: 9443Apply it and restart both Deployments to read the ConfigMaps:
Terminal window kubectl apply -k .kubectl rollout restart -n goiabada \deployment/goiabada-authserver deployment/goiabada-adminconsolekubectl rollout status -n goiabada deployment/goiabada-authserver --timeout=5mkubectl rollout status -n goiabada deployment/goiabada-adminconsole --timeout=5mKeep using
kubectl apply -k .: applying the wizard’s manifest alone undoes these settings. A manifest the wizard writes again stays this kustomization’s base. -
Sign in to the admin console and open Clients. This checks its HTTPS connection to the auth server.
An unreadable CA file, or one without a certificate, stops the console. A TLS failure keeps its new pod unready. Check its logs or Can’t reach the auth server:
Terminal window kubectl logs -n goiabada deployment/goiabada-adminconsole
Gateway to auth server
Section titled “Gateway to auth server”Complete the previous section first. This section is for a Gateway: with Ingresses, or routing of your own, the hop from your routing layer stays HTTP unless your controller’s own backend TLS settings encrypt it, which these steps don’t cover. A BackendTLSPolicy makes the gateway verify the auth server’s certificate on the Service’s https port. These steps are tested with Envoy Gateway v1.9.1.
-
Create the policy. Save this as
backend-tls.yaml. Use the Service’s namespace and ahostnamethat matches a DNS name in the certificate:apiVersion: gateway.networking.k8s.io/v1kind: BackendTLSPolicymetadata:name: goiabada-authservernamespace: goiabadaspec:targetRefs:- group: ""kind: Servicename: goiabada-authserversectionName: httpsvalidation:caCertificateRefs:- group: ""kind: ConfigMapname: goiabada-internal-cahostname: goiabada-authserver.goiabada.svc.cluster.localAdd
backend-tls.yamltoresourcesinkustomization.yaml. Apply it before changing the route:Terminal window kubectl apply -k .kubectl get backendtlspolicy goiabada-authserver -n goiabada -o yamlUnder
status.ancestors, wait forAcceptedandResolvedRefsto be"True", with theirobservedGenerationmatchingmetadata.generation. -
Switch the auth server’s route to 9443. Add this entry to
patchesinkustomization.yaml:- target:group: gateway.networking.k8s.ioversion: v1kind: HTTPRoutename: goiabada-authserverpatch: |-- op: replacepath: /spec/rules/0/backendRefs/0/portvalue: 9443Terminal window kubectl apply -k . -
Check the connection. Use your public auth server URL:
Terminal window curl --fail --show-error https://auth.example.com/healthAllow a few seconds for the gateway to update, then expect
healthy. Sign in and open Clients again. For a 503, check the policy’s status, certificate DNS names,ca.crtand NetworkPolicy’s 9443 rule.
The gateway’s hop to the admin console on 9091 is still HTTP. Use an encrypting network plugin or a service mesh to cover it too.
Certificate changes
Section titled “Certificate changes”The auth server reads its certificate and key only at start. The console reads its CA file only at start; the gateway watches the ConfigMap.
-
After each certificate renewal, restart the auth server:
Terminal window kubectl rollout restart -n goiabada deployment/goiabada-authserver -
When changing authorities, trust both during the switch. Put both CA certificates in
ca.pem, regenerate and applyinternal-ca.yaml, and restart the console before replacing the server’s certificate. Remove the old CA and restart the console once the switch is complete.