一成天一成天的坐在辦公室,真的很~~~,懵圈中....,求解救。api
本文經過《Kubernetes權威指南》的概念部分學習總結 tomcat
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: frontend spec: replicas: 1 selector: matchLabels: tier: frontend matchExpressions: - {key: tier, operator: In, values: [frontend]} template: metadata: labels: app: app-demo tier: frontend spec: containers: - name: tomcat-demo image: tomcat imagePullPolicy: IfNotPresent ports: - containerPort: 8080
[root@master ~]# kubectl create -f tomcat-deployment.yaml
deployment.extensions/frontend created
[root@master ~]# kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE frontend 1 1 1 1 23s
[root@master ~]# kubectl get pods NAME READY STATUS RESTARTS AGE frontend-6cfdb4d686-j8jj7 1/1 Running 0 9m
[root@master ~]# kubectl describe deployment Name: frontend Namespace: default CreationTimestamp: Fri, 20 Sep 2019 06:40:40 +0000 Labels: app=app-demo tier=frontend Annotations: deployment.kubernetes.io/revision=1 Selector: tier=frontend,tier in (frontend) Replicas: 1 desired | 1 updated | 1 total | 1 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=app-demo tier=frontend Containers: tomcat-demo: Image: tomcat Port: 8080/TCP Host Port: 0/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: frontend-6cfdb4d686 (1/1 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 9m deployment-controller Scaled up replica set frontend-6cfdb4d686 to 1