Terminate TLS connections in a Managed Kubernetes cluster for Envoy Gateway
Terminating a TLS connection for a Managed Kubernetes cluster is the process of decrypting HTTPS traffic and redirecting it to Kubernetes pods as HTTP traffic.
TLS connection termination can be used to:
- protect data transmission between a client and a service in a cluster;
- control access to services in a cluster and protect against unauthorized access;
- improve performance;
- simplify certificate management.
In a Managed Kubernetes cluster, TLS termination can be configured on a load balancer. TLS termination on a load balancer is available in clusters running Kubernetes version 1.25 and higher. You can upgrade the cluster version.
Certificates can be managed via the Certificates Manager — add your custom certificate or issue a Let’s Encrypt® certificate.
- Add a custom certificate or issue one in the secrets manager.
- Create a load balancer.
- Edit the domain's A record.
1. Add or issue a certificate
In Certificates Manager, you can upload a certificate issued by a third-party certificate authority or issue a Let’s Encrypt® certificate.
Add a certificate
Issue a Let’s Encrypt® certificate
-
A custom certificate is valid only in the project where it was added. Make sure you are in the correct project. To do this, open the project menu (name of the current project) and select a project.
-
In the Control Panel, in the top menu, click Products and select Certificates Manager.
-
In the Certificates section, click Add certificate.
-
Select Custom certificate.
-
Enter the certificate name.
-
Paste the main certificate for the domain. It must start with
-----BEGIN CERTIFICATE-----and end with-----END CERTIFICATE-----. -
Paste the private key. It must start with
-----BEGIN PRIVATE KEY-----and end with-----END PRIVATE KEY-----. -
Optional: to add an intermediate certificate:
8.1. Select the Add intermediate certificate checkbox.
8.2. In the Intermediate certificate field, paste the certificate. It must start with
-----BEGIN CERTIFICATE-----and end with-----END CERTIFICATE-----.If you need to add multiple intermediate certificates, make sure that all certificates (main certificate for the domain, intermediate, and root) form a complete chain. The
Issuervalue of the main certificate must match theSubjectvalue of the first intermediate certificate, theIssuervalue of the first intermediate certificate must match theSubjectvalue of the second intermediate certificate, and so on.Intermediate certificates can be added to the Intermediate certificate field in any order. It is important to use the full chain.
-
Optional: to add a root certificate:
9.1. Select the Add root certificate checkbox.
9.2. In the Root certificate field, paste the certificate. It must start with
-----BEGIN CERTIFICATE-----and end with-----END CERTIFICATE-----. -
Click Add.
-
Open the certificate page.
-
Copy the certificate UUID.
2. Create a load balancer
Use the Create load balancer subsection of the Create and configure a load balancer in a Managed Kubernetes cluster for Envoy Gateway instructions.
In the Gateway object manifest, add the annotation to the annotations block:
loadbalancer.openstack.org/default-tls-container-ref: "<certificate_uuid>"
Specify <certificate_uuid> — the universally unique identifier (UUID) of the certificate that you copied in the Add or issue a certificate instructions.
The created load balancer will appear in the Control Panel: in the top menu, click Products and select Cloud Servers → Load Balancers section → Load Balancers tab.
3. Change the A record for the domain
You can accelerate the propagation of resource record changes to caching servers. To do this, a few days before the planned change, reduce the record TTL to the minimum possible value. Then, at the scheduled time, change the resource record, and once the change has propagated to the caching servers, revert the TTL to its previous value.
- In the Control Panel, in the top menu, click Products and select DNS Hosting.
- In the Domain zones section, open the zone page.
- In the menu of the A record group, select Edit.
- Change the IP address to the address of the load balancer. You can view the load balancer IP address in the Control Panel: in the top menu, click Products and select Cloud Servers → Load Balancers → Load Balancers tab → load balancer card.
- Click Save.
- Wait for the resource record to update on the DNS servers. The update can take from the record group's TTL up to 72 hours. You can view the record group's TTL in the Control Panel: in the top menu, click Products → DNS Hosting → Domain zones → zone page → record row → TTL field.
- Optional: check the resource record. If the resource record is not updated after 72 hours, submit a ticket.
- Verify that requests are only reaching the load balancer and that there are no requests from users on the server.