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. MyBatis学习总结_Mybatis查询之resultMap和resultType区别

    MyBatis的每一个查询映射的返回类型都是ResultMap,只是当我们提供的返回类型属性是resultType的时候,MyBatis对自动的给我们把对应的值赋给resultType所指定对象的属性 ...

  2. MFC映射

    所有CDC输出函数最终都会输出到物理平面(屏幕窗口.打印纸等).这些物理平面的单位量化往往多种多样,比如像素.打印点.英寸.毫米等等.这样可能会造成很多混乱,所以CDC输出对所有物理平面进行统一抽象化 ...

  3. Windows server 2008R2远程桌面3389端口修改方法技巧

    windows server的服务器远程桌面默认端口号是3389,在工作中经常使用远程桌面连接服务器,但是这也是常常被黑客利用的端口号,但是如何修改掉默认端口,预防被黑客利用呢? 可以如下操作配置:很 ...

  4. VMware Converter Standalone支持Unix系统吗?

    支持的客户操作系统: Windows Vista SP2 (32-bit and 64-bit) Windows Server 2008 SP2 (32-bit and 64-bit) Windows ...

  5. 我的第一个python web开发框架(22)——一个安全小事故

    在周末的一个早上,小白还在做着美梦,就收到了小美的连环追魂call,电话一直响个不停. 小白打着哈欠拿起电话:早上好美女. 小美:出事了出事了,我们公司网站一早访问是一片空白,什么内容都没有了,你赶急 ...

  6. ios兼容 iphoneX ios10 ios11

    假设你有一个固定位置的标题栏,你的iOS10的CSS可能是这样写的: header { position: fixed; top:; left:; right:; height: 44px; padd ...

  7. python中的struct模块的学习

    由于TCP协议中的黏包现象的发生,对于最low的办法,每次发送之前让他睡一秒,然后在发送,可是这样真的太low了,而且太占用资源了. 黏包现象只发生在tcp协议中: 1.从表面上看,黏包问题主要是因为 ...

  8. IDEA+API && SPI

    JAVA中API和SPI的区别:https://blog.csdn.net/quanaianzj/article/details/82500019

  9. printf 函数原型

    typedef char *va_list; #define _AUPBND (sizeof (acpi_native_int) - 1) #define _ADNBND (sizeof (acpi_ ...

  10. .Net Core应用框架Util介绍(三)

    上篇介绍了Util的开发环境,并让你把Demo运行起来.本文将介绍该Demo的前端Angular运行机制以及目录结构. 目录结构 在VS上打开Util Demo,会看见如下的目录结构. 现代前端通常采 ...