Skip to content

Commit

Permalink
add doc how to customize CA for plgd services
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Feb 8, 2024
1 parent 5d9b20b commit 5a9f149
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions content/en/docs/deployment/hub/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,99 @@ global:
...
```

## Configuring Custom Certificate Authority for PLGD Hub Services

PLGD utilizes four types of service certificates:

- **External Services:** (e.g., gRPC Gateway, HTTP Gateway, Certificate Authority) exposed to the internet.
- **Internal Services:** (e.g., MongoDB, NATS, Resource Directory, etc.) communicating internally.
- **CoAP Gateway:** Communicating with devices.
- **Certificate Authority Service:** Used for signing certificates.

In the following steps, it uses one issuer for all service types. For your specific needs, you can separate each type of service by using a different issuer, such as Let's Encrypt for external services. To customize the Issuer for PLGD Hub services, follow these steps:

### Add Custom CA to Kubernetes Secret

Firstly, add the custom CA with the key pair to the Kubernetes secret. For a Cluster Issuer, include it in the `cert-manager` namespace.

```yaml
apiVersion: v1
kind: Secret
metadata:
name: plgd-ca-secret
namespace: cert-manager # or namespace in the case of issuer
type: kubernetes.io/tls
data:
ca.crt: <RootCA.crt encoded in base64> # Root CA
tls.crt: <CA.crt encoded in base64> # Root CA or Intermediate CA
tls.key: <CA.key encoded in base64> # Associated private key
```
Apply the secret to the Kubernetes cluster:
```sh
kubectl apply -f plgd-ca-secret.yaml
```

### Configure Issuer to Use Custom CA

Next, configure the issuer to use the custom CA:

```yaml
apiVersion: cert-manager.io/v1
kind: ClusterIssuer # or Issuer for namespace issuer
metadata:
name: plgd-ca-issuer
spec:
ca:
secretName: plgd-ca-secret
```
Apply the issuer configuration to the Kubernetes cluster:
```sh
kubectl apply -f plgd-ca-issuer.yaml
```

### Configure PLGD Hub Helm Chart

Finally, configure the PLGD Hub Helm chart to use the custom CA. Adjust the certificate duration according to your needs:

```yaml
certmanager:
external:
cert:
duration: 8760h # 1 year for external services
issuer:
kind: "ClusterIssuer" # or "Issuer"
name: "plgd-ca-issuer"
group: cert-manager.io
internal:
cert:
duration: 8760h # 1 year for internal services
issuer:
kind: "ClusterIssuer" # or "Issuer"
name: "plgd-ca-issuer"
group: cert-manager.io
coap:
cert:
duration: 8760h # 1 year for CoAP Gateway
issuer:
kind: "ClusterIssuer" # or "Issuer"
name: "plgd-ca-issuer"
group: cert-manager.io
default:
cert:
duration: 876000h # 100 years for intermediate CA
ca:
issuerRef:
kind: "ClusterIssuer" # or "Issuer"
name: "plgd-ca-issuer"
group: cert-manager.io
```
Apply the Helm chart configuration to the Kubernetes cluster.
## Troubleshooting
### Issue: Unable to fetch data from the ./well-known endpoint in browser
Expand Down

0 comments on commit 5a9f149

Please sign in to comment.