3. Kubernetes资源-概述
3.1 资源概念
Kubernetes中所有内容都抽象为资源,资源实例化之后叫做对象。Kubernetes的资源根据不同的维度可以分为:
- 工作负载型:Pod、ReplicaSet、Deployment、DaemonSet、Job/CronJob、StatefulSet
- 服务发现型:Service、Ingress
- 配置与存储:ConfigMap、Secret、Volume、PV-PVC
- 集群级别:Namespace、Role、ClusterRole、RoleBinding、ClusterRoleBinding
- 元数据型:HPA、PodTemplate、LimitRangs
3.2 资源清单
Kubernetes中一般使用YAML格式的文件来创建符合预期期望的Pod,这样的YAML文件称为资源清单。可以使用kubectl explain RESOURCE [options]查看不同资源支持的YAML标签。例如:查看Pod资源所支持的标签
[root@k8smaster43-11 优快云]# kubectl explain pod
KIND: Pod
VERSION: v1
DESCRIPTION:
Pod is a collection of containers that can run on a host. This resource is
created by clients and scheduled onto hosts.
FIELDS:
apiVersion <string>
APIVersion defines the versioned schema of this representation of an
object. Servers should convert recogni