Creating secrets

We already have the Cloud SQL proxy credentials in secrets/elixirdrip-prod-sql.json, so we now just have to create a secret based on this file. In the following snippet, we're creating a cloudsql-proxy-credentials secret that contains a file-based value named credentials.json, hence the --from-file option:

$ kubectl -n production create secret generic cloudsql-proxy-credentials --from-file=credentials.json=secrets/elixirdrip-prod-sql.jsonsecret "cloudsql-proxy-credentials" created

We will also need to pass the database user credentials to the application container. The following cloudsql-postgres-credentials secret has two literal values, named username and password:

$ kubectl -n production create secret generic cloudsql-postgres-credentials ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.