首页 > 社交 > 科普中国

云原生(十四)

常驻编辑 科普中国 2022-08-16 容器   钩子   字段   函数   仓库   状态   策略   事件   程序   资源

深入万物基础-容器

676拜客生活常识网

一、思考

我们在 k8s 里面的容器和 docker 的容器有什么异同?676拜客生活常识网

其实 docker 之前有自己的一套编排软件:docker swarm 它可以在多台主机中创建一个 docker 集群,但是也仅限于此了,docker 在很早就放弃了这个项目。docker machine 是配合 swarm 的一个预处理工具676拜客生活常识网

k8s 全称:kubernetes,因为中间有 8 个字母,所以简称 k8s,是谷歌公司开发的一款容器编排工具,占据了 80%以上的市场份额。676拜客生活常识网

k8s 的 Pod 是最小单位,Pod 中容器的配置需要注意以下常用的676拜客生活常识网

Pod 里面的容器内容可以写的东西676拜客生活常识网

args <[]string>676拜客生活常识网

command <[]string> Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $, ie: $(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell676拜客生活常识网

env <[]Object> 容器要用的环境变量676拜客生活常识网

envFrom <[]Object> List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.676拜客生活常识网

image 写镜像的名字676拜客生活常识网

imagePullPolicy 下载策略: Always:总是去下载: 【默认】 先看网上有没有,有了就下载,(本机也有,docker 就相当于不用下载了) Never:总不去下载,一定保证当前 Pod 所在的机器有这个镜像 ;直接看本机 IfNotPresent:如果本机没有就去下载;先看本机,再看远程676拜客生活常识网

lifecycle 生命周期钩子676拜客生活常识网

livenessProbe Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes676拜客生活常识网

name -required- 容器的名字676拜客生活常识网

ports <[]Object> 端口:676拜客生活常识网

readinessProbe Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes676拜客生活常识网

resources Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/676拜客生活常识网

相关阅读:

  • 米如何保存(储存大米最好的容器)
  • docker网络
  • 为应用赋能!博云容器云产品族正式发布
  • 加载、读取资源的方式
  • XaaS最全介绍(按24字母合集):AaaS、BaaS、CaaS、DaaS、I
  • Linux
  • 腌糖蒜,单放糖和醋不正宗,80岁姥姥教3招,糖蒜不蔫不坏更
  • 前端开源之PDF在线浏览组件PDFObject.js
  • 安琪酵母拟启动控股子公司宏裕包材在北交所上市的前期
  • 既是“穷人食物”也受总理青睐,酸菜轻松俘获德国人的胃
    • 网站地图 |
    • 声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。文章内容仅供参考,不做权威认证,如若验证其真实性,请咨询相关权威专业人士。