Junior — Middle
What are the main components and their configurations you performed in Kubernetes for deploying and managing applications?
sobes.tech AI
Answer from AI
The following main components and configurations are typically used for deploying and managing applications in Kubernetes:
- Pod — the smallest deployable unit containing one or more containers.
- Deployment — manages the creation and updating of pods, providing declarative application version control.
- Service — provides stable access to pods, load balancing, and allows access to the application via a stable IP or DNS.
- ConfigMap and Secret — manage configuration and secret data that can be attached to pods.
- Namespace — for logical separation of resources within the cluster.
- PersistentVolume and PersistentVolumeClaim — manage persistent storage.
Example of a simple Deployment with a service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-app-image:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
selector:
app: my-app
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
This set allows managing scaling, updates, and access to the application in Kubernetes.