|
| 1 | +# Proplet on Confidential Containers (CoCo) |
| 2 | + |
| 3 | +This directory contains resources for deploying Proplet on a Kubernetes cluster enabled with Confidential Containers (Kata Containers). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +* A Kubernetes cluster with [Confidential Containers](https://confidentialcontainers.org/) (Kata Containers) installed. |
| 8 | +* `kubectl` configured to access the cluster. |
| 9 | +* `docker` for building images (or another OCI builder). |
| 10 | +* A default StorageClass for handling ephemeral storage (optional but recommended). |
| 11 | + |
| 12 | +## Cluster Setup (Quick Start) |
| 13 | + |
| 14 | +To set up a local testing environment with Kind and Confidential Containers: |
| 15 | + |
| 16 | +1. **Create a Kind Cluster**: |
| 17 | + ```bash |
| 18 | + kind create cluster --name coco-test --config - <<EOF |
| 19 | + kind: Cluster |
| 20 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 21 | + nodes: |
| 22 | + - role: control-plane |
| 23 | + - role: worker |
| 24 | + EOF |
| 25 | + ``` |
| 26 | +
|
| 27 | +2. **Install the CoCo Operator**: |
| 28 | + Deploy the Confidential Containers Operator to install Kata Containers and required components. |
| 29 | +
|
| 30 | + ```bash |
| 31 | + kubectl apply -k github.com/confidential-containers/operator/config/release?ref=v0.8.0 |
| 32 | + ``` |
| 33 | +
|
| 34 | + *Note: Check the [CoCo Operator releases](https://github.com/confidential-containers/operator/releases) for the latest version.* |
| 35 | +
|
| 36 | +3. **Wait for Installation**: |
| 37 | + Wait for the `cc-runtime` runtime class to become available: |
| 38 | +
|
| 39 | + ```bash |
| 40 | + kubectl get runtimeclass |
| 41 | + # Should show 'kata', 'kata-qemu', or 'kata-fc' |
| 42 | + ``` |
| 43 | +
|
| 44 | + Ensure all operator pods are running: |
| 45 | + ```bash |
| 46 | + kubectl get pods -n confidential-containers-system |
| 47 | + ``` |
| 48 | +
|
| 49 | +## Deployment |
| 50 | +
|
| 51 | +The deployment setup consists of: |
| 52 | +* `proplet.yaml`: The main Deployment manifest. Checks for `runtimeClassName: kata` (default). |
| 53 | +* `proplet-config.yaml`: Configuration map containing `config.toml` (SuperMQ config) and environment variables. |
| 54 | +* `deploy_coco.sh`: A helper script to build and deploy. |
| 55 | +
|
| 56 | +### 1. Configuration |
| 57 | +
|
| 58 | +1. **Edit `proplet-config.yaml`**: |
| 59 | + * Set your `domain_id`, `client_id`, `client_key`, and `channel_id`. |
| 60 | + * These values configure Proplet to connect to the SuperMQ message broker. |
| 61 | +
|
| 62 | +2. **Edit `proplet.yaml`**: |
| 63 | + * Update `PROPLET_MQTT_ADDRESS` if your MQTT broker is not running locally (default `tcp://localhost:1883`). |
| 64 | + * Update `PROPLET_INSTANCE_ID` to a unique name for this instance. |
| 65 | + * Ensure `runtimeClassName` matches your cluster's CoCo runtime class (e.g., `kata-qemu`, `kata-fc`, or just `kata`). |
| 66 | +
|
| 67 | +### 2. Deploy |
| 68 | +
|
| 69 | +Use the helper script to build and deploy: |
| 70 | +
|
| 71 | +```bash |
| 72 | +./deploy_coco.sh |
| 73 | +``` |
| 74 | +
|
| 75 | +Or manually: |
| 76 | +
|
| 77 | +```bash |
| 78 | +# 1. Build image |
| 79 | +docker build -f ../docker/Dockerfile.proplet -t proplet:latest .. |
| 80 | +
|
| 81 | +# 2. Apply manifests |
| 82 | +kubectl apply -f proplet-config.yaml |
| 83 | +kubectl apply -f proplet.yaml |
| 84 | +``` |
| 85 | +
|
| 86 | +## Attestation Agent |
| 87 | +
|
| 88 | +In a CoCo environment, the Attestation Agent (AA) typically runs as a guest component inside the VM. |
| 89 | +Proplet is configured to communicate with the AA on `localhost:50002` (standard CoCo port). |
| 90 | +
|
| 91 | +To attest the environment, ensure: |
| 92 | +1. Your Kubernetes cluster is properly configured for remote attestation (KBS/KBC setup). |
| 93 | +2. The Attestation Agent is active in the Guest VM. |
| 94 | +
|
| 95 | +## Troubleshooting |
| 96 | +
|
| 97 | +**Pod stuck in `ContainerCreating`**: |
| 98 | +* Check if Kata runtime is available: `kubectl get runtimeclasses` |
| 99 | +* Check Kubelet logs for QEMU/Kata startup errors. |
| 100 | +
|
| 101 | +**Proplet fails to connect**: |
| 102 | +* Check logs: `kubectl logs -l app=proplet` |
| 103 | +* Verify network connectivity to the MQTT broker. |
0 commit comments