DESCRIPTION: Deployment enables declarative updates for Pods and ReplicaSets. FIELDS: apiVersion <string> APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind <string> Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata <ObjectMeta> Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata spec <DeploymentSpec> -required- Specification of the desired behavior of the Deployment. status <DeploymentStatus> Most recently observed status of the Deployment.
StatefulSet 是 Kubernetes 中用于管理有状态应用的工作负载资源。它和 Deployment 最根本的区别在于:Deployment 的 Pod 是可互换的、无身份的;而 StatefulSet 的每个 Pod 都有稳定且唯一的身份(序号、网络标识、存储),即使 Pod 被重建,这个身份也不会变。
$ kubectl explain pod.spec.containers.imagePullPolicy KIND: Pod VERSION: v1
FIELD: imagePullPolicy <string> ENUM: Always IfNotPresent Never
DESCRIPTION: Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images Possible enum values: - `"Always"` means that kubelet always attempts to pull the latest image. Container will fail If the pull fails. - `"IfNotPresent"` means that kubelet pulls if the image isn't present on disk. Container will fail if the image isn't present and the pull fails. - `"Never"` means that kubelet never pulls an image, but only uses a local image. Container will fail if the image isn't present
imagePullPolicy(镜像拉取策略)有三个可选值:
值
含义
简单理解
Always
kubelet 总是尝试拉取最新镜像,拉取失败则容器启动失败
每次都去仓库拉,不管本地有没有
IfNotPresent
本地磁盘没有该镜像时才拉取,拉取失败则容器失败
本地有就用本地,没有才去拉
Never
从不拉取,只用本地已有镜像;本地没有则容器失败
只用本地,绝不联网拉
默认值:如果镜像 tag 是 latest,默认为 Always;否则默认为 IfNotPresent。