- Learning DevOps
- Mikael Krief
- 141字
- 2021-06-24 12:32:02
Configuration and deployment in Kubernetes
Kubernetes is a container orchestrator—it is the technology that most embodies IaC, in my opinion, because the way it deploys containers, the network architecture (load balancer, ports, and so on), and the volume management, as well as the protection of sensitive information, are described completely in the YAML specification files.
Here is a simple example of a YAML specification file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-demo
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
We can see in the preceding specification file, the name of the image to deploy (ngnix), the port to open (80), and the number of replicas (2).
The Kubernetes part will be discussed in detail in Chapter 8, Managing Containers Effectively with Kubernetes.