I am new to Kubernetes but I have running docker-compose which basically deploys the Catalog API and Catalog DB.
While working with docker-compose:
I have used docker-compose.override.yaml to override the connection string from local to another container we have for the database like
DatabaseSettings:ConnectionString=Server=catalog,1433;Database=catalogDb;User Id=sa;Password=secretPassw@rd;
In this sense, both the containers are working and the Catalog API container is able to connect to Catalog DB Container without any issue.
Now, coming to the Kubernetes:
I know we have a secret and config map in Kubernetes but those are for individual item replacement by adding those into the deployment kind definition in Kubernetes.
I probably can add the entire connection string as Kubernetes secret and use that as an environment but I have three questions:
- Is that a correct approach?
- What is the server name should I specify in Kubernetes secret?
- Inside a secret file, can we do string interpolation or contamination like we specific SQL Password for SQL container instance but the same password can we reference while we provide the Connection string for Catalog API without writing it the same again?
Just give you a reference, Here is what I have created: