深入万物基础-容器

一、思考
我们在 k8s 里面的容器和 docker 的容器有什么异同?
其实 docker 之前有自己的一套编排软件:docker swarm 它可以在多台主机中创建一个 docker 集群,但是也仅限于此了,docker 在很早就放弃了这个项目。docker machine 是配合 swarm 的一个预处理工具
k8s 全称:kubernetes,因为中间有 8 个字母,所以简称 k8s,是谷歌公司开发的一款容器编排工具,占据了 80%以上的市场份额。
k8s 的 Pod 是最小单位,Pod 中容器的配置需要注意以下常用的
Pod 里面的容器内容可以写的东西
args <[]string>
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-shell
env <[]Object> 容器要用的环境变量
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.
image
写镜像的名字 imagePullPolicy
下载策略: Always:总是去下载: 【默认】 先看网上有没有,有了就下载,(本机也有,docker 就相当于不用下载了) Never:总不去下载,一定保证当前 Pod 所在的机器有这个镜像 ;直接看本机 IfNotPresent:如果本机没有就去下载;先看本机,再看远程 lifecycle
livenessProbe
name
-required- 容器的名字 ports <[]Object> 端口:
readinessProbe
resources