-
Notifications
You must be signed in to change notification settings - Fork 18
Deploy CRA on Kubernetes
In order for Kubernetes to deploy CRA in a pod, the Docker image for CRA workers must have been generated and uploaded to a Docker registry before-hand, as described in the instructions here. On this page, we assume that we are working with a CRA Docker image named mydockeraccount/cra-0.1-debug
on Docker Hub.
-
Make sure you have access to a Kubernetes cluster via a ‘kubectl’ command-line tool, as described here.
-
Open a command prompt and change directory to
src\CRA.Worker
-
Edit the deployment YAML file
cra-two-instances.yml
to update your Docker image name, instance name, add new instances, etc. -
Set the storage account name using a ConfigMap
cra-config
.kubectl create configmap cra-config --from-literal=azure_storage_conn_string=your_storage_key
If you need to update this in the future, you can first delete it as follows:
kubectl delete configmap cra-config
The YAML uses this ConfigMap variable to set the environment variable
AZURE_STORAGE_CONN_STRING
in Docker containers, for use by the deployed CRA workers. -
Deploy a pod to your cluster as follows.
kubectl create -f cra-two-instances.yml
-
To see if the pod deployed successfully, you can query the Kubernetes cluster as follows:
kubectl get pods
You may also use the web browser to monitor your pods by starting a local proxy as follows:
kubectl proxy
This starts up a local web proxy that you can visit by pointing your browser to the path shown on the command line.
You can also monitor the output of your pods by dumping the logs as follows:
kubectl logs <your-pod-name>
A full list of kubectl commands is available here.
-
After you are done, make sure to delete your deployments (and shut down ACS).
kubectl delete deployment crainst01 crainst02