Although you can deploy the microservices built on top of Light to a data center with java -jar or with Docker, the ultimate deployment platform would be a Kubernetes cluster.
Before deploying a service to a Kubernetes cluster, you need to create secrets with all the externalized configuration files. These files usually are copied to the config folder in each project in llight-config-test or light-config-prod. For a detailed directory structure, please refer to petstore.
To create secrets, make sure you have all the configuration files in the config folder. Then run the following create_secrets.sh:
Note that hostNetwork is used so that the service can register itself to Consul during startup. Also, status.hostIP is passed to the container to get the host IP address. The previously created secret is used in the volumes and volumeMounts.
To start the service:
kubectl create -f deployment.yaml
To delete the service:
kubectl delete -f deployment.yaml
To list all the running pods:
kubectl get pods
In the above deployment.yaml, we have set the memory limit for the container. To verify that, let’s put some load on the server and see if the service respects the limitation.
To access the server, go to the consul server first to find the IP and port number for the petstore service. Verify if it works with a curl command:
curl -k https://22.214.171.124:2408/v2/pet/111
Now use the wrk to generate some load for 5 minutes: