5. Prepare Deployment Config
Pre-reads
Know the basics of Kubernetes: https://www.youtube.com/watch?v=PH-2FfFD2PU&t=3s
Know the basics of kubectl commands
Know kubernetes manifests: https://www.youtube.com/watch?v=ohSUtEfDefc
Know how to manage env values, secrets of any service deployed in kubernetes https://www.youtube.com/watch?v=OW244LxB4oI
Know how to port forward to a pod running inside k8s cluster and work locally https://www.youtube.com/watch?v=TT3nd5n5Yus
Know sops to secure your keys/creds: https://www.youtube.com/watch?v=DWzJ87KbwxA
Post Kubernetes Cluster setup, the deployment has got 2 stages. As part of this sample exercise we can deploy PGR and show what are the various configuration required, however deployment steps are similar for all other modules too, just that the prerequisites differ depending on the feature like SMS Gateway, Payment Gateway, etc
1. Prepare Deployment Configuration File
It's important to prepare a your global deployment configuration yaml file that will contain all the necessary user specific custom values like URL, gateways, persistent storage ids, DB details etc.
Navigate to the following file in your local machine from previously cloned DevOps git repository
Clone the following DIGIT-DevOps repo (If not already done as part of Infra setup), you may need to install git and then run git clone it to your machine.
root@ip:/# git clone -b release https://github.com/egovernments/DIGIT-DevOps
After cloning the repo CD into the folder DIGIT-DevOps and type the "code ." command that will open the visual editor and opens all the files from the repo DIGIT-DevOps
root@ip:/# cd DIGIT-DevOps root@ip:DIGIT-DevOps# code .
Update the deployment config file with your details, you can use the following template egov-demo-sample.
/DIGIT-DevOps/config-as-code/environments/egov-demo.yaml
Here you need to replace the following as per your values
URL that you want to access DIGIT
SMS gateway to receive otp, transaction mobile notification, etc
MDMS, Config repo url, here is where you provide master data, tenants and various user/role access details.
GMap key for the location service
Payment gateway, in case you use PT, TL, etc
Important: You have to add the aws volume_ids and zone in egov-demo.yaml that you got as a terraform output (Kafka, Zk, elasticsearch, etc)
Update your credentials and sensitive data in the secret file as per your details.
/DIGIT-DevOps/config-as-code/environments/egov-demo-template-secrets.yaml
credentials, secrets (You need to encrypt using sops and create a <env>-secret.yaml separately)
SOPS expects an encryption key to use it to encrypt/decrypt a specified plain text and keep the details secured, there are couple of option which you can use it to generate the encryption key
Option 1: Generate PGP keys https://fedingo.com/how-to-generate-pgp-key-in-ubuntu
Option 2: Create AWS KMS keys when you want to use AWS cloud provider.
Once you generate your encryption key, create a .sops.yaml configuration file under the /helm directory of the cloned repo to define which keys are used for which specific file. refer to the sops doc for info.
Note: For demo purpose, you can use the egov-demo-secrets.yaml as it is without sops configuration, but make sure you update your specific details like Git SSH, URL etc. When you decide to push these configurations into any git or public space, please make sure you follow the sops configuration mentioned in this article sops to encrypt your secrets.
You have to fork the following repos that contains the master data and default configs which you would customize as per your specific implementation later point in time. Like (Master Data, ULB, Tenant details, Users, etc) to your respective github account.
Once you fork the repos into your GitHub account, Create a github user account, and generate ssh authentication key( generate new SSH key and add it to above user account.
New github user should be enabled to access the earlier forked repo's
Add the ssh private key which you generated in the previous step to egov-demo-secrets.yaml under the git-sync section.
Modify the services git-Sync repo and branch with your fork repo and branch in egov-demo.yaml
/DIGIT-DevOps/config-as-code/environments/egov-demo-secrets.yaml
Update the deployment configs for the below as per your specification
Number of replicas/scale of each individual services (Depending on whether dev or prod load)
You must update sms g/w, email g/w, payment g/w details for the notification and payment gateway services, etc.
Update the config, mdmd github repos wherever marked
Update GMap key (In case you are using Google Map services in your PGR, PT, TL, etc)
You must create one private s3 Bucket for Filestore and one public bucket for logos and add the bucket details respectively and create an IAM user with the s3 bucket access. Add IAM user details to <env-secrets.yaml>.
URL/DNS on which the DIGIT will be exposed
SSL Certificate for the above URL
Any specific endpoints configs (Internal/external)
/DIGIT-DevOps/config-as-code/environments/egov-demo.yaml
All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Last updated
Was this helpful?