Closed prateeksahu closed 3 years ago
GSC currently hard-codes the environment variables based on the initial values in the original Docker image. See starting from here: https://github.com/oscarlab/graphene/blob/master/Tools/gsc/gsc.py#L93
To support your use-case, GSC needs a way to propagate environment-specified envvars into the Graphene SGX enclave (in your case, Kubernetes sets these envvars and propagates them to each Docker container). There is currently no such functionality in Graphene and in GSC, though we can add a switch to "insecurely propagate environment variables from the host" to GSC -- this would be a simply workaround but obviously insecure.
Alternative solution is to use Marblerun, which actually runs the "pre-main" logic to populate the envvars with correct values given by Kubernetes. See https://www.marblerun.sh/.
TLDR: You hit a legitimate limitation of GSC, and there is currently no solution other than using Marblerun... Thanks for reporting this, we'll need to do something about envvars in GSC.
Thanks @dimakuv I have used marblerun as well, and I was actually trying to run graphene with the sample app that marblerun uses so that I can study the pros and cons of the two. Can you help me try the insecure way of env var propagation? Since this is a very initial research experiment and not a production level deployment, I might be okay with it.
Check this https://graphene.readthedocs.io/en/latest/manifest-syntax.html#environment-variables.
I guess it would be enough to add loader.insecure__use_host_env = true
to this file: https://github.com/oscarlab/graphene/blob/848f9617acfec9fd719871a3adfd3e38ad94ea40/Tools/gsc/templates/entrypoint.manifest.template
This is of course only for a research experiment.
Thanks @dimakuv for the quick support. This helped me navigate past the blocker. I am now able to run the application.
For future readers, the line to be added is loader.insecure__use_host_env = 1
and it can be added to your own manifest file (image.manifest
in my case) or the entrypoint.manifest.template
as suggested above. I decided to add it to my own so as to keep the original files clean.
Description of the problem
Unable to deploy simple microservice application (emojivoto - https://github.com/BuoyantIO/emojivoto/) using graphene GSC.
Steps to reproduce
System: Azure VM DC8_v2 (8 cpu, 32G mem) Kernel: 5.11.16
Run GSC tool on specific container images - emojivoto-web, emojivoto-emoji-svc, emojivoto-voting-svc config.yaml
manifest (named image.manifest)
Steps to graphenize the images:
docker pull docker.l5d.io/buoyantio/emojivoto-emoji-svc:v11
docker tag docker.l5d.io/buoyantio/emojivoto-emoji-svc:v11 emojivoto-emoji-svc:latest
./gsc build --insecure-args -c config.yaml emojivoto-emoji-svc image.manifest
./gsc sign-image emojivoto-emoji-svc ~/graphene/Pal/src/host/Linux-SGX/signer/enclave-key.pem
docker tag gsc-emojivoto-emoji-svc:latest gsc-emojivoto-emoji-svc:v1
above steps were executed for all three images (voting, emoji and web)
kubernetes cluster - minikube (driver=none) deploy the application using kubectl
kubectl apply -k kustomize/deployment
The yaml files under
development/
were updated to use thegsc-
containers built above.Expected results
The application should run as expected
Actual results
The pods crash repeatedly with environment variable errors. Eg -