Skip to content

Commit e814733

Browse files
committed
docs: Update Azure & GCP installation using Helm charts
Updated documentation for Azure and Google cloud to use Helm charts. Signed-off-by: Pawel Proskurnicki <pawel.proskurnicki@intel.com>
1 parent 8d869a4 commit e814733

File tree

2 files changed

+182
-218
lines changed

2 files changed

+182
-218
lines changed

content/en/docs/examples/azure-simple.md

Lines changed: 98 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ Confidential Containers also supports using Azure Key Vault as a resource backen
1919

2020
## Pre-requisites
2121

22-
- Install Azure CLI by following instructions [here](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli).
23-
- Install kubectl by following the instructions [here](https://kubernetes.io/docs/tasks/tools/#kubectl).
24-
- Ensure that the tools `curl`, `git`, `jq` and `sipcalc` are installed.
22+
1. **Install Required Tools**:
23+
- [Microsoft Azure CLI (`az`)](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
24+
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
25+
- [Helm](https://helm.sh/docs/intro/install)
26+
- Ensure that the tools `curl`, `git`, `jq` and `sipcalc` are installed.
2527

2628
## Azure Preparation
2729

@@ -136,7 +138,7 @@ CAA needs privileges to talk to Azure API. This privilege is granted to CAA by a
136138
Start by creating an identity for CAA:
137139

138140
```bash
139-
export AZURE_WORKLOAD_IDENTITY_NAME="caa-${CLUSTER_NAME}"
141+
export AZURE_WORKLOAD_IDENTITY_NAME="${CLUSTER_NAME}-identity"
140142

141143
az identity create \
142144
--name "${AZURE_WORKLOAD_IDENTITY_NAME}" \
@@ -208,19 +210,19 @@ export AKS_OIDC_ISSUER="$(az aks show \
208210

209211
```bash
210212
az identity federated-credential create \
211-
--name "caa-${CLUSTER_NAME}" \
213+
--name "${CLUSTER_NAME}-federated" \
212214
--identity-name "${AZURE_WORKLOAD_IDENTITY_NAME}" \
213215
--resource-group "${AZURE_RESOURCE_GROUP}" \
214216
--issuer "${AKS_OIDC_ISSUER}" \
215217
--subject system:serviceaccount:confidential-containers-system:cloud-api-adaptor \
216218
--audience api://AzureADTokenExchange
217219
```
218220

219-
## Deploy CAA
221+
## Deploy the Helm chart
220222

221223
> **Note**: If you are using Calico Container Network Interface (CNI) on the Kubernetes cluster, then, [configure](https://projectcalico.docs.tigera.io/networking/vxlan-ipip#configure-vxlan-encapsulation-for-all-inter-workload-traffic) Virtual Extensible LAN (VXLAN) encapsulation for all inter workload traffic.
222224
223-
### Download the CAA deployment artifacts
225+
### Download the helm deployment artifacts
224226

225227
{{< tabpane text=true right=true persist=header >}}
226228
{{% tab header="**Versions**:" disabled=true /%}}
@@ -231,7 +233,7 @@ az identity federated-credential create \
231233
export CAA_VERSION="0.17.0"
232234
curl -LO "https://github.com/confidential-containers/cloud-api-adaptor/archive/refs/tags/v${CAA_VERSION}.tar.gz"
233235
tar -xvzf "v${CAA_VERSION}.tar.gz"
234-
cd "cloud-api-adaptor-${CAA_VERSION}/src/cloud-api-adaptor"
236+
cd "cloud-api-adaptor-${CAA_VERSION}/src/cloud-api-adaptor/install/charts/peerpods"
235237
```
236238

237239
{{% /tab %}}
@@ -242,18 +244,19 @@ cd "cloud-api-adaptor-${CAA_VERSION}/src/cloud-api-adaptor"
242244
export CAA_BRANCH="main"
243245
curl -LO "https://github.com/confidential-containers/cloud-api-adaptor/archive/refs/heads/${CAA_BRANCH}.tar.gz"
244246
tar -xvzf "${CAA_BRANCH}.tar.gz"
245-
cd "cloud-api-adaptor-${CAA_BRANCH}/src/cloud-api-adaptor"
247+
cd "cloud-api-adaptor-${CAA_BRANCH}/src/cloud-api-adaptor/install/charts/peerpods"
246248
```
247249

248250
{{% /tab %}}
249251

250252
{{% tab header="DIY" %}}
251-
This assumes that you already have the code ready to use. On your terminal change directory to the Cloud API Adaptor's code base.
253+
This assumes that you already have the code ready to use. On your terminal change directory to the Cloud API Adaptor's
254+
code base.
252255
{{% /tab %}}
253256

254257
{{< /tabpane >}}
255258

256-
### CAA pod VM image
259+
### Export PodVM image version
257260

258261
{{< tabpane text=true right=true persist=header >}}
259262
{{% tab header="**Versions**:" disabled=true /%}}
@@ -287,13 +290,14 @@ Above image version is in the format `YYYY.MM.DD`, so to use the latest image sh
287290

288291
{{% tab header="DIY" %}}
289292

290-
If you have made changes to the CAA code that affects the pod VM image and you want to deploy those changes then follow [these instructions](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/azure/build-image.md) to build the pod VM image. Once image build is finished then export image id to the environment variable `AZURE_IMAGE_ID`.
293+
If you have made changes to the CAA code that affects the pod VM image, and you want to deploy those changes then follow [these instructions](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/azure/build-image.md) to build the pod VM image.
294+
Once image build is finished then export image id to the environment variable `AZURE_IMAGE_ID`.
291295

292296
{{% /tab %}}
293297

294298
{{< /tabpane >}}
295299

296-
### CAA container image
300+
### Export CAA container image path
297301

298302
{{< tabpane text=true right=true persist=header >}}
299303
{{% tab header="**Versions**:" disabled=true /%}}
@@ -335,33 +339,6 @@ If you have made changes to the CAA code and you want to deploy those changes th
335339

336340
{{< /tabpane >}}
337341

338-
### Annotate Service Account
339-
340-
Annotate the CAA Service Account with the workload identity's `CLIENT_ID` and make the CAA DaemonSet use workload identity for authentication:
341-
342-
```yaml
343-
cat <<EOF > install/overlays/azure/workload-identity.yaml
344-
apiVersion: apps/v1
345-
kind: DaemonSet
346-
metadata:
347-
name: cloud-api-adaptor-daemonset
348-
namespace: confidential-containers-system
349-
spec:
350-
template:
351-
metadata:
352-
labels:
353-
azure.workload.identity/use: "true"
354-
---
355-
apiVersion: v1
356-
kind: ServiceAccount
357-
metadata:
358-
name: cloud-api-adaptor
359-
namespace: confidential-containers-system
360-
annotations:
361-
azure.workload.identity/client-id: "$USER_ASSIGNED_CLIENT_ID"
362-
EOF
363-
```
364-
365342
### Select peer-pods machine type
366343

367344
{{< tabpane text=true right=true persist=header >}}
@@ -397,91 +374,100 @@ export DISABLECVM="true"
397374
{{% /tab %}}
398375
{{< /tabpane >}}
399376

400-
### Populate the `kustomization.yaml` file
401-
402-
Run the following command to update the [`kustomization.yaml`](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/install/overlays/azure/kustomization.yaml) file:
403-
404-
```yaml
405-
cat <<EOF > install/overlays/azure/kustomization.yaml
406-
apiVersion: kustomize.config.k8s.io/v1beta1
407-
kind: Kustomization
408-
bases:
409-
- ../../yamls
410-
images:
411-
- name: cloud-api-adaptor
412-
newName: "${CAA_IMAGE}"
413-
newTag: "${CAA_TAG}"
414-
generatorOptions:
415-
disableNameSuffixHash: true
416-
configMapGenerator:
417-
- name: peer-pods-cm
418-
namespace: confidential-containers-system
419-
literals:
420-
- CLOUD_PROVIDER="azure"
421-
- AZURE_SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID}"
422-
- AZURE_REGION="${AZURE_REGION}"
423-
- AZURE_INSTANCE_SIZE="${AZURE_INSTANCE_SIZE}"
424-
- AZURE_RESOURCE_GROUP="${AZURE_RESOURCE_GROUP}"
425-
- AZURE_SUBNET_ID="${AZURE_SUBNET_ID}"
426-
- AZURE_IMAGE_ID="${AZURE_IMAGE_ID}"
427-
- DISABLECVM="${DISABLECVM}"
428-
secretGenerator:
429-
- name: peer-pods-secret
430-
namespace: confidential-containers-system
431-
- name: ssh-key-secret
432-
namespace: confidential-containers-system
433-
files:
434-
- id_rsa.pub
435-
patchesStrategicMerge:
436-
- workload-identity.yaml
377+
### Populate the `providers/azure.yaml` file
378+
379+
List of all available configuration options can be found in two places:
380+
- [Main charts values](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/install/charts/peerpods/values.yaml)
381+
- [Azure specific values](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/install/charts/peerpods/providers/azure.yaml)
382+
383+
Run the following command to update the [`providers/azure.yaml`](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/install/charts/peerpods/providers/azure.yaml) file:
384+
385+
```bash
386+
cat <<EOF > providers/azure.yaml
387+
provider: azure
388+
image:
389+
name: "${CAA_IMAGE}"
390+
tag: "${CAA_TAG}"
391+
providerConfigs:
392+
azure:
393+
AZURE_IMAGE_ID: "${AZURE_IMAGE_ID}"
394+
AZURE_REGION: "${AZURE_REGION}"
395+
AZURE_RESOURCE_GROUP: "${AZURE_RESOURCE_GROUP}"
396+
AZURE_SUBNET_ID: "${AZURE_SUBNET_ID}"
397+
AZURE_SUBSCRIPTION_ID: "${AZURE_SUBSCRIPTION_ID}"
398+
AZURE_INSTANCE_SIZE: "${AZURE_INSTANCE_SIZE}"
399+
DISABLECVM: ${DISABLECVM}
437400
EOF
438401
```
439402

440-
The SSH public key should be accessible to the `kustomization.yaml` file:
441-
442-
```bash
443-
cp $SSH_KEY install/overlays/azure/id_rsa.pub
444-
```
445-
446-
### Deploy CAA on the Kubernetes cluster
447-
448-
Deploy coco operator. Usually it's the same version as CAA, but it can be adjusted.
449-
450-
```bash
451-
export COCO_OPERATOR_VERSION="${CAA_VERSION}"
452-
kubectl apply -k "github.com/confidential-containers/operator/config/release?ref=v${COCO_OPERATOR_VERSION}"
453-
kubectl apply -k "github.com/confidential-containers/operator/config/samples/ccruntime/peer-pods?ref=v${COCO_OPERATOR_VERSION}"
454-
```
455-
456-
Run the following command to deploy CAA:
457-
458-
```bash
459-
kubectl apply -k "install/overlays/azure"
460-
```
461-
462-
Generic CAA deployment instructions are also described [here](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/install/README.md).
463-
464-
### Deploy a controller for garbage collecting PodVMs
465-
466-
Run the following command to deploy the Peerpod CRD
467-
468-
```bash
469-
pushd ../peerpod-ctrl
470-
kubectl apply -k config/default
471-
popd
472-
```
403+
### Deploy helm chart on the Kubernetes cluster
404+
405+
1. Create namespace managed by Helm:
406+
```bash
407+
kubectl apply -f - << EOF
408+
apiVersion: v1
409+
kind: Namespace
410+
metadata:
411+
name: confidential-containers-system
412+
labels:
413+
app.kubernetes.io/managed-by: Helm
414+
annotations:
415+
meta.helm.sh/release-name: peerpods
416+
meta.helm.sh/release-namespace: confidential-containers-system
417+
EOF
418+
```
419+
420+
2. Create the secret using `kubectl`:
421+
422+
See [providers/azure-secrets.yaml.template](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/src/cloud-api-adaptor/install/charts/peerpods/providers/azure-secrets.yaml.template) for required keys.
423+
424+
```bash
425+
kubectl create secret generic my-provider-creds \
426+
-n confidential-containers-system \
427+
--from-literal=AZURE_CLIENT_ID="$USER_ASSIGNED_CLIENT_ID" \
428+
--from-literal=AZURE_CLIENT_SECRET='' \
429+
--from-literal=AZURE_TENANT_ID='' \
430+
--from-file=id_rsa.pub="$SSH_KEY"
431+
```
432+
433+
> **Note**: Above example assumes that you are using workload identity for authentication hence
434+
> `AZURE_CLIENT_SECRET` and `AZURE_TENANT_ID` are left empty.
435+
436+
> **Note**: `--from-file=id_rsa.pub="$SSH_KEY"` is optional. It allows user to SSH into the pod VMs for troubleshooting purposes.
437+
> This option works only for custom debug enabled pod VM images. The prebuilt pod VM images do not have SSH connection enabled.
438+
439+
3. Install helm chart:
440+
441+
Below command uses customization options `-f` and `--set` which are described [here](../../getting-started/installation/advanced_configuration).
442+
443+
```bash
444+
helm install peerpods . \
445+
-f providers/azure.yaml \
446+
--set secrets.mode=reference \
447+
--set secrets.existingSecretName=my-provider-creds \
448+
--set-json daemonset.podLabels='{"azure.workload.identity/use":"true"}' \
449+
--dependency-update \
450+
-n confidential-containers-system
451+
```
452+
453+
> **Note**: Above example assumes that you are using workload identity for authentication. <br>
454+
> This line: `--set-json daemonset.podLabels='{"azure.workload.identity/use":"true"}'` is required **only** when using workload identity.
455+
456+
Generic Peer pods Helm charts deployment instructions are also described
457+
[here](https://github.com/confidential-containers/cloud-api-adaptor/tree/main/src/cloud-api-adaptor/install/charts/peerpods/README.md).
473458
474459
## Run sample application
475460
476461
### Ensure runtimeclass is present
477462
478-
Verify that the `runtimeclass` is created after deploying CAA:
463+
Verify that the `runtimeclass` is created after deploying Peer Pods Helm Charts:
479464
480465
```bash
481466
kubectl get runtimeclass
482467
```
483468
484-
Once you can find a `runtimeclass` named `kata-remote` then you can be sure that the deployment was successful. A successful deployment will look like this:
469+
Once you can find a `runtimeclass` named `kata-remote` then you can be sure that the deployment was successful.
470+
A successful deployment will look like this:
485471
486472
```console
487473
$ kubectl get runtimeclass

0 commit comments

Comments
 (0)