• k8s定义yaml文件常用的一些字段


    spec:
      replicas: 6  # 定义副本数量
      strategy:
        rollingUpdate: # 滚动更新通过参数 maxSurge 和 maxUnavailable 来控制副本替换的数量
          maxSurge: 35%
          maxUnavailable: 35% 
      template:
        spec:
          containers:
            livenessProbe:
              exec:
                command:
                - cat
                - /tmp/healthy # 定义存活健康检查(exec方式)
            readinessProbe: # 定义就绪健康检查(httpGet方式)
              httpGet:
                scheme: HTTP
                path: /healthy
                port: 8080
              initialDelaySeconds: 10
              periodSeconds: 5
            volumeMounts: # 使用empty_dir作为存储(pod不在,volume也在)
            - mountPath: /consumer_dir
              name: shared-volume
            - mountPath: /etc/ssl/certs  # 使用host-path作为存储
              name: ca-certs
              readOnly: true
            - mountPath: /test-ebs # 使用外部的storage provider作为存储
              name: ebs-volume
            - name: foo # 通过volume的方式来使用secret
              mountPath: "/etc/foo"
              readOnly: true
            - name: foo # 通过volume的方式来使用configmap
              mountPath: /etc/foo
              readOnly: true
            env: # 通过env的方式来使用secret
              - name: SECRET_USERNAME
                valueFrom:
                  secretKeyRef:
                    name: my-secret
                    key: username
              - name: SECRET_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: my-secret
                    key: password
              - name: CONFIG_1 # 通过env的方式来使用configmap
                valueFrom:
                  configMapKeyRef:
                    name: my-configmap1
                    key: config1
              - name: CONFIG_2
                valueFrom:
                  configMapKeyRef:
                    name: my-configmap1
                    key: config2
          volumes:
          - name: shared-volume
            emptyDir: {}
          - hostPath:  # 使用host-path作为存储
              path: /etc/ssl/certs
              type: DirectoryOrCreate
            name: ca-certs
          - name: ebs-volume # 使用外部的storage provider作为存储
            awsElasticBlockStore:
              volumeID: <volume-id>
              fsType: ext4
          - name: wwwroot # 定义使用pvc来做存储
            persistentVolumeClaim:
              claimName: my-pvc
          - name: foo # 通过volume的方式来使用secret
            secret:
              secretName: mysecret
            items: # 自定义存放数据的文件名
            - key: username
              path: my-group/my-username
            - key: password
              path: my-group/my-password
          - name: foo # 通过volume的方式来使用configmap
            configMap:
              name: my-configmap
              items:
                - key: logging.conf
                  path: myapp/logging.conf
          nodeSelector:
            disktype: ssd  # 定义节点标签选择器
    
  • 相关阅读:
    linux MySQL安装指南
    Ubuntu MySQL常用命令
    linux下 mysql 忘记root用户密码解决办法
    ubuntu mysql 启动命令/配置my.cnf
    Ubuntu中给mysql添加新用户并分配权限
    各种 ADSL Modem 及路由器的端口映射方法
    (转)有关SharePoint页面定制的若干细节
    获取Excel中的Sheet的名称
    获取excel表单中的数据
    如何用Excel 2007同步MOSS列表(转)
  • 原文地址:https://www.cnblogs.com/Richardo-M-Q/p/14139928.html
Copyright © 2020-2023  润新知