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
    
  • 相关阅读:
    ini 文件
    基元类型、引用 类型与值类型
    C#的 is 和 as 类型转换
    MVC 项目中为什么会有两个web.config
    Linux下安装SVN服务端小白教程
    测试博文中添加可执行JS代码
    坑爹坑娘坑祖宗的87端口(记一次tomcat故障排查)
    fsfds
    高斯混合模型Gaussian Mixture Model (GMM)
    ggplot2绘制概率密度图
  • 原文地址:https://www.cnblogs.com/orange-lsc/p/11923272.html
Copyright © 2011-2022 走看看