|
| 1 | +# Best Practice: Managing sandbox-manager Self-Signed Certificates with cert-manager |
| 2 | + |
| 3 | +This document provides a best practice for managing and deploying sandbox-manager self-signed certificates using |
| 4 | +cert-manager. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +1. sandbox-manager is installed in the cluster |
| 9 | +2. Ensure kubectl command-line tool is available with appropriate permissions |
| 10 | + |
| 11 | +## Step 1: Install cert-manager |
| 12 | + |
| 13 | +If you haven't installed cert-manager yet, please refer to |
| 14 | +the [official documentation](https://cert-manager.io/docs/installation/) for installation. |
| 15 | + |
| 16 | +## Step 2: Automatic Certificate Management with cert-manager |
| 17 | + |
| 18 | +1. Replace "*.your.domain.com" and "your.domain.com" in [cert-manager.yaml](cert-manager.yaml) with your domain. |
| 19 | +2. Add the configuration to the Kubernetes cluster: `kubectl apply -f cert-manager.yaml` |
| 20 | + |
| 21 | +## Step 3: Verify Certificate Status |
| 22 | + |
| 23 | +Check if certificates are created and issued correctly: |
| 24 | + |
| 25 | +```bash |
| 26 | +kubectl get certificates -n sandbox-system |
| 27 | +kubectl describe certificate sandbox-manager-ingress-cert -n sandbox-system |
| 28 | +kubectl describe secret sandbox-manager-tls -n sandbox-system |
| 29 | +``` |
| 30 | + |
| 31 | +Check Ingress status: |
| 32 | + |
| 33 | +```bash |
| 34 | +kubectl get ingress sandbox-manager -n sandbox-system |
| 35 | +kubectl describe ingress sandbox-manager -n sandbox-system |
| 36 | +``` |
| 37 | + |
| 38 | +## Step 4: Configure Client Trust |
| 39 | + |
| 40 | +Since you are using self-signed certificates, clients need to trust the root CA certificate. |
| 41 | + |
| 42 | +### 4.1 Obtain CA Certificate |
| 43 | + |
| 44 | +```bash |
| 45 | +kubectl get secret sandbox-ca-key-pair -n sandbox-system -o jsonpath='{.data.tls\.crt}' | base64 -d > ca.crt |
| 46 | +``` |
| 47 | + |
| 48 | +### 4.2 Configure Client |
| 49 | + |
| 50 | +Clients need to set the environment variable `SSL_CERT_FILE` to the path of the obtained CA certificate: |
| 51 | + |
| 52 | +```bash |
| 53 | +export SSL_CERT_FILE=/path/to/ca.crt |
| 54 | +``` |
| 55 | + |
| 56 | +Or add the CA certificate to the system's trust store. |
0 commit comments