Kubernetes 常用资源

  • 资源  对象
  1. 工作负载型资源对象(workload): Pod  Replicaset  ReplicationController  Deployments StatefulSets Daemonset Job CronJob
  2. 服务发现及负载均衡: Service  Ingress
  3. 配置与存储:Volumes CSl  configmap  secret
  4. 集群资源:Namespace Node Role ClusterRole  RoleBinding  ClusterRoleBinding
  5. 元数据资源:HPA PodTemplate LimitRang

创建资源清单的方法

  • apiserver 仅接受JOSN格式的资源定义
  • yaml格式提供配置清单,apiserver自动转成json格式,然后在提交

大部分资源的配置清单:

  • apiVersion:  格式:group/version   查看 kubectl apiversion
  • kind:  Pod  Replicaset  Deployments ...
  • metadata: name namespace labels  annotations
  • spec: 定义用户期望状态  disired state
  • status: 定义当前状态 current state 该字段由kubenetes集群维护;

通过 yaml写一个简单的 pod应用

$ vim my-demo.yaml 

apiVersion: v1
kind: Pod
metadata:
name: my-demo
namespace: default
labels:
name: myapp
tier: appfront
spec:
containers:
- name: myapp
image: ikubernetes/myapp:v1
- name: busybox
image: busybox
command:
- "/bin/sh"
- "-c"
- "sleep 3600"

$ kubectl apply -f my-demo.yaml

通过 kubectl  describe pods my-demo 查看集群信息

通过命令查看如何定义资源  (标有 required  意味是必填项)

$ kubectl  explain deployment
DESCRIPTION:
DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for more information. Deployment enables declarative updates for Pods and ReplicaSets. FIELDS:
status <Object>
Most recently observed status of the Deployment. 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/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/api-conventions.md#types-kinds metadata <Object>
Standard object metadata. spec <Object>
Specification of the desired behavior of the Deployment. $ kubectl explain deployment.spec RESOURCE: spec <Object> DESCRIPTION:
Specification of the desired behavior of the Deployment. DeploymentSpec is the specification of the desired behavior of the Deployment. FIELDS:
paused <boolean>
Indicates that the deployment is paused and will not be processed by the
deployment controller. revisionHistoryLimit <integer>
The number of old ReplicaSets to retain to allow rollback. This is a
pointer to distinguish between explicit zero and not specified. template <Object> -required-
Template describes the pods that will be created. rollbackTo <Object>
DEPRECATED. The config this deployment is rolling back to. Will be cleared
after rollback is done. selector <Object>
Label selector for pods. Existing ReplicaSets whose pods are selected by
this will be the ones affected by this deployment. strategy <Object>
The deployment strategy to use to replace existing pods with new ones.
......

Kubenetes 资源清单定义入门的更多相关文章

  1. k8s学习笔记之四:资源清单定义入门

    第一章.k8s中的资源 1.什么叫资源? k8s中所有的内容都抽象为资源, 资源实例化之后,叫做对象 2.在k8s中有哪些资源? 工作负载型资源(workload): Pod ReplicaSet D ...

  2. k8s资源清单定义入门

    1.资源分类 a.workload型资源:service.pod.deployment.ReplicaSet.StatefulSet.Job.Cronjob; b.服务发现及服务均衡资源型资源:Ser ...

  3. 04-kubernetes 资源清单定义入门

    目录 资源对象 创建资源的方法 清单帮助命令 创建测试清单 资源的三种创建方式 资源对象 workload:Pod, ReplicaSet, Deployment, StatefulSet, Daem ...

  4. Kubernetes 学习5 kubernetes资源清单定义入门

    一.kubernetes是有一个restful风格的 API,把各种操作对象都一律当做资源来管理.并且可通过标准的HTTP请求的方法 GET,PUT,DELETE,POST,等方法来完成操作,不过是通 ...

  5. kubernetes 资源清单定义入门

    k8s中的资源 什么叫资源? k8s中所有的内容都抽象为资源, 资源实例化之后,叫做对象 在k8s中有哪些资源? 工作负载型资源(workload): Pod ReplicaSet Deploymen ...

  6. 5、kubernetes资源清单定义入门

    使用配置清单创建资源 定义pod时使用yaml格式 master ~]# kubectl get pod NAME READY STATUS RESTARTS AGE client / Error 1 ...

  7. 四,k8s集群资源清单定义入门

    目录 资源对象 创建资源的方法 清单帮助命令 创建测试清单 资源的三种创建方式 资源对象 workload:Pod, ReplicaSet, Deployment, StatefulSet, Daem ...

  8. kubernetes系列06—kubernetes资源清单定义入门

    本文收录在容器技术学习系列文章总目录 1.认识kubernetes资源 1.1 常用资源/对象 workload工作负载型资源:pod,ReplicaSet,Deployment,StatefulSe ...

  9. 4、kubernetes资源清单快速入门190625

    一.资源清单概念 资源/对象的类型 工作负载型资源:Pod, ReplicaSet, Deployment, StatefulSet, DaemonSet, Job, Cronjob, ... 服务发 ...

随机推荐

  1. 数据库H2学习

    本文转载自:https://www.cnblogs.com/xdp-gacl/p/4171024.html 一.H2数据库介绍 常用的开源数据库有:H2,Derby,HSQLDB,MySQL,Post ...

  2. LeetCode算法题-To Lower Case(Java实现)

    这是悦乐书的第301次更新,第320篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第169题(顺位题号是709).实现具有字符串参数str的函数ToLowerCase() ...

  3. OpenGL实例:三角形

    OpenGL实例:三角形 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 更多请查看:计算机图形学 1. 三角形的旋转 #include <GL/ ...

  4. React.js开发的基本配置(配了两天)

    记录下心酸的过程: 1.安装npm 安装node.js,这时候你就可以使用npm了. 因为官方的源下载npm的包比较慢,所以可以用淘宝的源,这时候使用nrm来进行npm源的切换 在cmd中执行 npm ...

  5. Linux运维高级-核心知识提高

    一.Linux之定时任务crond 二.Linux之用户管理 三.Linux之初识磁盘 四.Linux之磁盘管理 五.Linux三剑客-SED 六.Linux三剑客-AWK 七.初识shell编程 八 ...

  6. 创建DVWA环境时遇到的问题

    前言:我下载了PHP Study,也按照步骤下载保存了DVWA,之后我又按照百度的准备登陆检查是否正确安装DVWA,于是,我登录了百度上查到的链接:http://localhost/DVWA-mast ...

  7. C. Maximal Intersection(STL)

    这道题,关键在于怎么求多个区间的交集,使用multiset就可以 分别将 r , l 存在不同的mutiset中. 然后,我们来看一下 是不是 交集的 l 是最大的, 交集的 r 是最小的 #incl ...

  8. vmware centos7 minimal 配置共享文件夹

    使用的是VMware安装CentOS7 minimal版,系统镜像是CentOS-7-x86_64-DVD-1708.iso. 宿主机系统为win10,CentOS7 minimal过程省略,可参考h ...

  9. zabbix相关

    链接:https://pan.baidu.com/s/1gjwZrJGCYM1NWJhhK7IhiQ  密码:76nm

  10. ABP中的模块初始化过程(一)

    在总结完整个ABP项目的结构之后,我们就来看一看ABP中这些主要的模块是按照怎样的顺序进行加载的,在加载的过程中我们会一步步分析源代码来进行解释,从而使自己对于整个框架有一个清晰的脉络,在整个Asp. ...