Service Serving Certificate
TOC
OverviewFeaturesConfiguration and Deployment (For Administrators)Prerequisites1. Configure RBAC Permissions2. Create Certificate3. Configure Kyverno PoliciesUser Guide (For Developers)Overview
Service serving certificates provide automated TLS certificate generation and management for Services in the container cloud platform. This capability enables secure HTTPS communication and encrypted traffic between internal components, ensuring data privacy and system security.
Features
This automated certificate provisioning mechanism provides the following key features:
- Zero-touch Provisioning: Developers do not need to manually generate Certificate Signing Requests (CSRs) or interact with certificate authorities. Certificate issuance is fully automated via standard Kubernetes annotations.
- Cross-namespace CA Synchronization: Eliminates the hassle of manually copying the platform root CA to every business namespace. The root CA certificate is automatically synchronized, enabling services to easily verify each other's identities.
- Automated Lifecycle Management: Leveraging
cert-managerensures that certificates are not only automatically issued but also seamlessly renewed before expiration, minimizing operational overhead and preventing outages due to expired certificates. - Standardized Security: Ensures that TLS certificates are generated using a unified, centrally managed
ClusterIssuer, maintaining consistent security standards across all applications on the platform.
Configuration and Deployment (For Administrators)
To implement the above functions, platform system administrators need to provision the related admission policies (ClusterPolicy) for Kyverno and the necessary RBAC permissions in advance.
Prerequisites
Before proceeding, ensure that the Alauda Container Platform Compliance with Kyverno plugin is installed and enabled in your cluster. For installation details, please refer to Install Compliance Plugin.
1. Configure RBAC Permissions
To grant Kyverno the permissions to create corresponding resources and call related interfaces, aggregate the following permissions to the platform's background controller:
2. Create Certificate
Create the following Certificate resource to act as the service root CA:
3. Configure Kyverno Policies
Create and apply the following three core ClusterPolicy resources:
- clone-ca-secret: Listens to Namespace creation events and generates the
service-root-caSecret resource for new namespaces. - sync-ca-rotation: Listens to changes in
service-root-ca, obtains the real CA certificate content via the API, and synchronizes theca.crtvalue to the Secret in the target namespace. - generate-service-cert: Listens to Service resources with the
service.alauda.io/serving-cert-secret-nameannotation and generates aCertificateissuance request with wildcard domain support based on its name and namespace.
Save the following YAML content as a file and execute the application (kubectl apply -f):
User Guide (For Developers)
For application developers, once the underlying cluster policies are in place, there is no need to worry about the underlying certificate issuance logic. You only need to append an exclusive annotation when defining a business Service resource to achieve automatic certificate provisioning:
- Add Annotation to the Service
Under the business namespace (e.g., my-namespace), create or update your Service, and add the service.alauda.io/serving-cert-secret-name annotation to specify the name of the generated certificate Secret. For example:
- Verify the Generated Certificate Secret
After applying the above Service:
- Check if the auto-generated TLS certificate Secret exists in the namespace:
- Check if the root CA certificate used for verification has also been automatically copied to the current namespace:
- Mount and Use the Certificate in Pods
Since the CA certificate Secret (service-root-ca) and the current application's TLS serving certificate Secret (my-secure-service-tls) are in place, you can mount them as data volumes in workloads such as your target application's Deployment or StatefulSet.
Here is a specific Deployment YAML example demonstrating how to mount these certificates:
For more configuration details regarding workloads via the web console, refer to the Configure Containers section.