Services

Resources

Company

🏅

7 - Deploy REST API & its dependent services in K8s

Learning Outcomes

  • Learn how to create & modify Kubernetes manifests.

  • Learn different Kubernetes service types.

  • Learn about External Secrets Operator.

Problem Statement

Earlier we were deploying our application and its dependent service on bare-metal Vagrant box, going forward we will deploy it on top of Kubernetes. We need to create Kubernetes manifests for our application and its dependent services.

Expectations

The following expectations should be met to complete this milestone.

  • All Kubernetes manifests should be committed in the same GitHub repository and should follow the proper directory structure.

  • Each component (application, DB) should have a single manifest file, which has all the different Kubernetes components. For example, the application.yml file should contain - namespace, configMap, secret, deployment, and service, etc. i.e. all K8s resource definitions required for the application to be deployed on K8s. Similarly, database.yml file should contain similar K8s resource definition for running database container on K8s.

  • DB DML migrations should run before you start the application pod, as an init container.

  • Application and DB components should be deployed in student-api namespace. Similarly, other components should be deployed in the respective namespace and on the appropriate node. Here’s the deployment diagram for reference.

notion image
  • You need to use ConfigMaps for passing environment variables.

  • DB credentials and other sensitive information should be injected using Kubernetes External Secrets Operator(ESO).

  • Hashicorp Vault should be deployed in the Kubernetes cluster and configured to be used as a secret store for ESO.

  • You need to expose the REST API using the K8s service.

  • You should get status code 200 while making the request using Postman collection for different API endpoints.

  • README.md should be updated with appropriate instructions for deploying our stack in a K8s cluster.

Further Reading