2020-07-27 资源编排(YAML)

2020-07-27  本文已影响0人  阿丧小威

1. YAML文件格式说明

YAML是一种简洁的非标记语言。
语法格式:

示例:

[root@k8s-master1 ~]# kubectl get deploy -o yaml
apiVersion: v1
items:
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    annotations:
      deployment.kubernetes.io/revision: "1"
    creationTimestamp: "2020-07-26T13:15:28Z"
    generation: 1
    labels:
      app: web
    name: web
    namespace: default
    resourceVersion: "14633"
    selfLink: /apis/apps/v1/namespaces/default/deployments/web
    uid: c85e6a81-e83f-4afd-a427-15b44d44c0cc
  spec:
    progressDeadlineSeconds: 600
    replicas: 1
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: web
    strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: web
      spec:
        containers:
        - image: nginx
          imagePullPolicy: Always
          name: nginx
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        terminationGracePeriodSeconds: 30
  status:
    availableReplicas: 1
    conditions:
    - lastTransitionTime: "2020-07-26T13:48:32Z"
      lastUpdateTime: "2020-07-26T13:48:32Z"
      message: Deployment has minimum availability.
      reason: MinimumReplicasAvailable
      status: "True"
      type: Available
    - lastTransitionTime: "2020-07-26T13:48:32Z"
      lastUpdateTime: "2020-07-26T13:48:32Z"
      message: ReplicaSet "web-d86c95cc9" has successfully progressed.
      reason: NewReplicaSetAvailable
      status: "True"
      type: Progressing
    observedGeneration: 1
    readyReplicas: 1
    replicas: 1
    updatedReplicas: 1
---省略若干---

2. YAML文件创建资源对象

图片.png
图片.png

3. 资源字段太多,记不住怎么办

上一篇下一篇

猜你喜欢

热点阅读