-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployment.txt
47 lines (41 loc) · 1.04 KB
/
deployment.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: my-app
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: my-app
spec:
containers:
- name: nginx-container
image: nginx:latest
replicas: 6
selector:
matchLabels:
app: myapp
#create
> kubectl cretae -f deployment-definition.yaml
> kubectl create deployment nginx --image=nginx:1.16
#get
> kubectl get deployments
kubectl describe deploy simple-webapp-deployment | grep -i image
#update
> kubectl apply -f deployment-definition.yaml
> kubectl set image deployment/myapp-deployment nginx=nginx:1.9.1
> kubectl set image deployment nginx nginx=nginx:1.17 --record
> kubectl edit deployments nginx --record
#status
> kubectl rollout status deployment/myapp-deployment
> kubectl rollout history deployment/myapp-deployment
> kubectl rollout history deployment nginx --revision=1
#rollback
> kubectl rollout undo deployment/myapp-deployment
#delete
kubectl delete deployment myapp-deployment