Advanced Kubernetes configuration
This section describes advanced Kubernetes resources that play a fundamental role in application design. Other advanced resources and configurations related specifically to security and observability will be described in Chapter 10, Security and Observability for Serverless and Microservices Applications.
Let’s start with secrets.
Secrets
Kubernetes allows various kinds of Secrets. Here, we will describe just generic
and tls
secrets, which are the ones used in the practical development of applications based on microservices.
Each generic Secret contains a collection of entry-name/entry-value pairs. Secrets can be defined with .yaml
files, but since it is not prudent to mix sensitive information with code, they are usually defined with kubectl
commands.
Below is how to define a Secret, taking the entry values from file contents:
kubectl create secret generic credentials --from-file=username.txt --from-file=password.txt...