You must know
Deployment
is going to create ReplicaSet
automatically.
YAML - deployment-definition.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| apiVersion: apps/v1
kind: Deployment
metadata: # -> Deployment
name: myapp-deployment
labels:
app: myapp
type: front-end
spec: # -> Deployment
template:
metadata: # -> POD
name: myapp-pod
labels:
app: myapp
type: front-end
spec: # -> POD
containers:
- name: nginx-continer
image: nginx
replicas: 3
selector:
matchLabels:
type: front-end
|
Create a Deployment
1
| kubectl create -f deployment-definition.yml
|
Show Deployment List
1
2
3
4
5
6
7
8
9
10
11
| # Show Deployment
kubectl get deployments
# Show ReplicaSet that is created by Deployment
kubectl get replicaset
# Show PODs that is created by above ReplicaSet
kubectl get pods
# Show all of them
kubectl get all
|
Show Deployment Detail
1
| kubectl describe deployment myapp-deployment
|
Change Running Deployment
1
| kubectl edit deployment myapp-deployment
|
Delete Deployment
1
| kubectl delete deployment myapp-deployment
|