1.部署与运行nginx应用
# kubectl run nginx --image=nginx --replicas=2 --port=8080 --hostport=80
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/nginx created
2.查看部署状态
# kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 2/2 2 2 4m55s
3.查看部署nginx的信息
# # kubectl describe deployment nginx
Name: nginx
Namespace: default
CreationTimestamp: Tue, 14 Jan 2020 23:06:27 +0800
Labels: run=nginx
Annotations: deployment.kubernetes.io/revision: 1
Selector: run=nginx
Replicas: 2 desired | 2 updated | 2 total | 1 available | 1 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: run=nginx
Containers:
nginx:
Image: nginx
Port: 8080/TCP
Host Port: 80/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available False MinimumReplicasUnavailable
Progressing True ReplicaSetUpdated
OldReplicaSets: <none>
NewReplicaSet: nginx-66dbb56b98 (2/2 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 35s deployment-controller Scaled up replica set nginx-66dbb56b98 to 2
4.查看部署创建两个日志
# kubectl get replicaset
NAME DESIRED CURRENT READY AGE
nginx-66dbb56b98 2 2 2 2m54s
5.查看部署pod网络
# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-66dbb56b98-nrjnl 1/1 Running 0 102s 10.244.2.4 storage <none> <none>
nginx-66dbb56b98-vvr5d 1/1 Running 0 102s 10.244.1.10 computer <none> <none>