Skip to content

Commit

Permalink
Add example to deploy a GSC Python image to AKS cluster
Browse files Browse the repository at this point in the history
Signed-off-by: aneessahib <[email protected]>
  • Loading branch information
aneessahib authored and Dmitrii Kuvaiskii committed Jun 7, 2022
1 parent df3f1b5 commit 43d771d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Examples/aks-python-helloworld/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Deploying a "HelloWorld" graminized Python Docker image to AKS cluster

This example demonstrates how to translate the Python Docker Hub image to a
graminized image, which can be readily deployed to a confidential compute AKS
cluster.

*Warning:* this example relies on insecure arguments provided at runtime and
should not be used in production. To use trusted arguments, please see
[GSC documentation](https://gramine.readthedocs.io/projects/gsc).

- Pull Python image:

docker pull python

- Graminize the Python image using GSC, and allow insecure runtime arguments:

./gsc build --insecure-args python python.manifest

- Sign the graminized image with your enclave signing key:

./gsc sign-image python enclave-key.pem

- Push resulting image to Docker Hub or your preferred registry:

docker tag gsc-python <dockerhubusername>/gsc-aks-python
docker push <dockerhubusername>/gsc-aks-python

- Deploy `gsc-aks-python` job:

kubectl apply -f gsc-aks-python-deployment.yaml

- Test job status:

kubectl get jobs -l app=gsc-aks-python-deployment

- Receive logs of job:

kubectl logs -l app=gsc-aks-python-deployment

- Delete job after completion:

kubectl delete -f gsc-aks-python-deployment.yaml
22 changes: 22 additions & 0 deletions Examples/aks-python-helloworld/gsc-aks-python-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: batch/v1
kind: Job
metadata:
name: gsc-aks-python
labels:
app: gsc-aks-python
spec:
template:
metadata:
labels:
app: gsc-aks-python
spec:
containers:
- name: gsc-aks-python
image: <dockerhubusername>/gsc-aks-python
imagePullPolicy: Always
args: ["-c", "print('HelloWorld!')"] # WARNING: providing args in the deployment file is insecure!
resources:
limits:
sgx.intel.com/epc: "10Mi"
restartPolicy: Never
backoffLimit: 0
2 changes: 2 additions & 0 deletions Examples/aks-python-helloworld/python.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sgx.enclave_size = "512M"
sgx.thread_num = 4

0 comments on commit 43d771d

Please sign in to comment.