kubernetes资源类别介绍

类别 名称
资源对象 Pod、ReplicaSet、ReplicationController、Deployment、StatefulSet、DaemonSet、Job、CronJob、HorizontalPodAutoscaling
配置对象 Node、Namespace、Service、Secret、ConfigMap、Ingress、Label、ThirdPartyResource、 ServiceAccount
存储对象 Volume、Persistent Volume
策略对象 SecurityContext、ResourceQuota、LimitRange
 
 #获取资源配置清单信息
#1.获取api-version资源信息
kubectl  api-versions


#获取yaml文件编写需要的内容
kubectl  explain  [资源名字]

#查看创建pod需要的信息

kubectl explain pods

#查看pod中spec需要的信息

kubectl explain pods.spec


kubernetes 中yaml文件数据定义介绍

apiVersion: api版本
kind: 资源类型
metadata: #源数据
name: 名字
namespace:所在命名空间
labels: 标签信息(可以多个)
app: 标签内容

spec:期望状态
containers:容器信息(可以多个名称云镜像)
- name: 自定义name名称
image:镜像名
- name:
image:

例如:

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  namespace: default
  labels: 
    app: my-pod
     
spec:
  containers:
  - name: my-pod
    image: nginx
  - name: mybusybox
    image: busybox
    command:
    - "/bin/sh"
    - "-c"
    - "echo `date` >>/tmp/aa.txt "
例子

猜你喜欢

转载自www.cnblogs.com/zhangb8042/p/9572701.html
今日推荐