Understanding Kubernetes
Kubernetes (K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.
Key Concepts
- Pods
- Services
- Deployments
- ConfigMaps
- Secrets
Basic Pod Definition
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
Simple Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
Common Commands
# Get cluster info
kubectl cluster-info
# Create resources
kubectl apply -f deployment.yaml
# List resources
kubectl get pods
kubectl get deployments
Stay tuned for more Kubernetes tutorials!