Closed devops-ng closed 4 years ago
This is covered in section 11.5.1 on Kubernetes secrets: https://livebook.manning.com/book/api-security-in-action/chapter-11/v-8/249
The master branch tracks the latest completed chapter and is often ahead of what has been published in the early-access book. There are git branches for each chapter as discussed in the README which are generally easier to get running.
I saw that, and I even pointed it in my initial message. Having the file you linked to doesn't solve the issue. I still get that error above. The Java code is looking for 2 files (/etc/secrets/database/username
, and /etc/secrets/database/password
). And not the file presented in the book (/etc/secrets/database
). Can you please double check?
The Kubernetes secret is created with
kubectl create secret generic db-password -n natter-api \
--from-literal=username=natter \
--from-literal=password=password
which is then mounted into the image in listing 11.11:
volumeMounts:
- name: db-password
mountPath: "/etc/secrets/database"
readOnly: true
That will result in two files being created under /etc/secrets/database/username and /etc/secrets/database/password
Thank you. I got it now.
If we try to use the natter-api from this repository after running
mvn clean compile exec:java
we get the following error:It clearly expects
username
to be a directory. There are 0 references to this in the whole book. The only reference found is to/etc/secrets/database
wheredatabase
is a file. Do you mind give an example of what's expected here to get this built?