kubectl
Simple
kubectl apply -f poc_k8s/deployment.yml
kubectl apply -f poc_k8s/service.yml
Récursif
kubectl apply -f poc_k8s --recursive
Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-nginx
labels:
app: test-nginx
env: dev
spec:
replicas: 3
selector:
matchLabels:
app: test-nginx
template:
metadata:
labels:
app: test-nginx
spec:
containers:
- name: nginx
image: nginx
Service
apiVersion: v1
kind: Service
metadata:
name: test-nginx
labels:
app: test-nginx
env: dev
spec:
type: NodePort
selector:
app: test-nginx
ports:
- name: http
protocol: TCP
port: 80
nodePort: 30101