zoukankan      html  css  js  c++  java
  • kubernetes-字段小结练习

    一级字段: apiVersion、kind、metadata、spec、status
    修改镜像中的应用: command、args
    标签: labels
    标签选择器: selector
        等值关系: =,==,!=
        集合关系: 
            KEY in (VALUE1,VALUE2...)
            KEY notin (VALUE1,VALUE2...)
    资源内嵌标签选择器:
        matchLabels
        matchExpressions
          操作符:
              In, Notin: values字段的值必须为非空列表
              Exists, NotExists: values字段的值必须为空列表
    节点标签选择器: nodeSelector
    指定节点: nodeName
    注解: annotations
        与label不同在于,他不能挑选资源对象,仅用于为对象提供“元数据”
    容器探测:
        liveness
        readiness
        lifecycle:
          postStart: #容器启动之后
          preStop: #容器关闭之前
    探针类型:
        ExecAction,TCPSocketAction,HTTPGetAction
    镜像策略:
        imagePullPolicy: IfNotPresent  #如果不存在则拉取
    重启策略:
        RestarPolicy
    
    
    apiVersion: v1
    kind: Service
    metadata:
      name: nginx
      namespace: default
      labels:
        app: nginx
    spec:
      selector:
        app: nginx
      type: NodePort
      ports:
      - port: 80
        targetPort: 80
        nodePort: 30002
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx
      namespace: default
      labels:
        app: nginx
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: nginx:1.14-alpine
            imagePullPolicy: IfNotPresent
            ports:
            - name: http
              containerPort: 80
            lifecycle:
              postStart:
                exec:
                  command: ["/bin/sh", "-c", "hostname >> /usr/share/nginx/html/index.html"]
            livenessProbe:
              httpGet:
                port: http
                path: /index.html
              initialDelaySeconds: 60
    
  • 相关阅读:
    “”开天眼“”,天地分割效果
    关于获得当前的index的方法
    echart(2),模拟数据导入篇
    腾讯windows系统服务器
    elsarticle模板 去掉Preprint submitted to
    elsarticle模板 去掉摘要前后的两条横线
    LeetCode 345. Reverse Vowels of a String
    path变量修改后无法保存
    LeetCode 13: Roman to Integer
    LeetCode 118. Pascal's Triangle
  • 原文地址:https://www.cnblogs.com/orange-lsc/p/11923272.html
Copyright © 2011-2022 走看看