zoukankan      html  css  js  c++  java
  • Pod中spec的字段常用字段及含义

    一、Podspec字段常用字段及含义

    1、pod.spec.containers

    ²  spec.containers.name <string>  #pod的名称,必须字段,名称唯一且对象创建后不可以被修改
    ²  spec.containers.image <string> #镜像仓库的路径/镜像的名称:镜像的标签
              spec.containers.image.imagePullPolicy  <string> #镜像的下载策略。有三种:Always(总是去仓库下载) ,Never(从不去仓库下载) , IfNotPresent(如果本地没有就去仓库下载)     默认是"IfNotPresent"  但是,如果镜像的标签是latest,则总会是"Always,并且对象一旦被创建,这个字段不允许被改变
    ²  spec.containers.ports: #容器公开的端口列表。在这里公开端口可以为系统提供关于容器使用的网络连接的额外信息,但主要是提供信息。在这里不指定端口不会阻止该端口被公开。任何监听容器内默认的“0.0.0.0”地址的端口都可以从网络访问
              spec.containers.ports.containerPort  #pod暴露的端口,此端口仅是额外的信息,对端口是否被暴露没有影响
              spec.containers.ports.hostPort <integer>   #主机上公开的端口
              spec.containers.ports.protocol <string>    #端口的协议
              spec.containers.ports.hostIP   <string>    #指定要绑定的主机
    ²  spec.containers.command <[]string> #运行的程序,类似于docker中的entrypiont,并且这里的命令不会运行在shell中,如果没有这个字段docker镜像会运行自己entrypiont中的指令
     
    ²  pod.spec.containers.volumeMounts 
      pod.spec.containers.volumeMounts.name
      pod.spec.containers.volumeMounts.mountPath #可以被容器挂载的存储卷的路径,路径不能包含':' 符号
      pod.spec.containers.volumeMounts.subPath #可以被容器挂载的存储卷的路径,并且不会覆盖挂载点中的文件
      pod.spec.containers.volumeMounts.readOnly #是否只读,默认为false
    pod.spec.containers.resources
    ²  spec.containers.resources.limits    #资源限制
       spec.containers.resources.limits.cpu : CPU 上限, 可以短暂超过, 容器也不会被停止
       spec.containers.resources.limits.memory : 内存上限, 不可以超过; 如果超过, 容器可能会被终止或调度到其他资源充足的机器上
    ²  spec.containers.resources.requests   #资源需求
       spec.containers.resources.requests.cpu : CPU 请求, 也是调度 CPU 资源的                                                        依据, 可以超过
       spec.containers.resources.requests.memory : 内存请求, 也是调度内存资源                      的依据, 可以超过; 但如果超过, 容器可能会在 Node 内存不足时清理
     
     

    ²  args:相当于dockerfile里面的cmd

    ²  command:相当于docker里面的Entrypoint

      如果既没有指定args,也没有指定command,那么会默认使用dockfile的cmd和entrypoint。 

      如果指定了command,但没有提供args,那么就直接运行command。 

      如果指定了args,但是没指定command,那么将使用镜像中的entrypoint命令,把我们写的args当做参数传递给镜像中的entrypoint。

    如果既用来command,又用了args,那么镜像中的cmd和entrypoint将被忽略,而使用K8s提供的command with args。

  • 相关阅读:
    Mybatis动态SQL
    Mybatis05__#和$的区别
    Mybatis04__输入参数/输出参数
    数据库中的字段和实体类中的字段不一致
    Mybatis中常用注解
    Mybatis03__配置文件简介
    Mybatis实现增、删、改操作时返回主键
    Mybatis04__CURD
    Mybatis02__Mybatis搭建
    lxrunoffline的使用
  • 原文地址:https://www.cnblogs.com/chuangcc/p/10616804.html
Copyright © 2011-2022 走看看