Kubenetes 资源清单定义入门
Kubernetes 常用资源
- 资源 对象
- 工作负载型资源对象(workload): Pod Replicaset ReplicationController Deployments StatefulSets Daemonset Job CronJob
- 服务发现及负载均衡: Service Ingress
- 配置与存储:Volumes CSl configmap secret
- 集群资源:Namespace Node Role ClusterRole RoleBinding ClusterRoleBinding
- 元数据资源: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 资源清单定义入门的更多相关文章
- k8s学习笔记之四:资源清单定义入门
第一章.k8s中的资源 1.什么叫资源? k8s中所有的内容都抽象为资源, 资源实例化之后,叫做对象 2.在k8s中有哪些资源? 工作负载型资源(workload): Pod ReplicaSet D ...
- k8s资源清单定义入门
1.资源分类 a.workload型资源:service.pod.deployment.ReplicaSet.StatefulSet.Job.Cronjob; b.服务发现及服务均衡资源型资源:Ser ...
- 04-kubernetes 资源清单定义入门
目录 资源对象 创建资源的方法 清单帮助命令 创建测试清单 资源的三种创建方式 资源对象 workload:Pod, ReplicaSet, Deployment, StatefulSet, Daem ...
- Kubernetes 学习5 kubernetes资源清单定义入门
一.kubernetes是有一个restful风格的 API,把各种操作对象都一律当做资源来管理.并且可通过标准的HTTP请求的方法 GET,PUT,DELETE,POST,等方法来完成操作,不过是通 ...
- kubernetes 资源清单定义入门
k8s中的资源 什么叫资源? k8s中所有的内容都抽象为资源, 资源实例化之后,叫做对象 在k8s中有哪些资源? 工作负载型资源(workload): Pod ReplicaSet Deploymen ...
- 5、kubernetes资源清单定义入门
使用配置清单创建资源 定义pod时使用yaml格式 master ~]# kubectl get pod NAME READY STATUS RESTARTS AGE client / Error 1 ...
- 四,k8s集群资源清单定义入门
目录 资源对象 创建资源的方法 清单帮助命令 创建测试清单 资源的三种创建方式 资源对象 workload:Pod, ReplicaSet, Deployment, StatefulSet, Daem ...
- kubernetes系列06—kubernetes资源清单定义入门
本文收录在容器技术学习系列文章总目录 1.认识kubernetes资源 1.1 常用资源/对象 workload工作负载型资源:pod,ReplicaSet,Deployment,StatefulSe ...
- 4、kubernetes资源清单快速入门190625
一.资源清单概念 资源/对象的类型 工作负载型资源:Pod, ReplicaSet, Deployment, StatefulSet, DaemonSet, Job, Cronjob, ... 服务发 ...
随机推荐
- 高端内存映射之vmalloc分配内存中不连续的页--Linux内存管理(十九)
1 内存中不连续的页的分配 根据上文的讲述, 我们知道物理上连续的映射对内核是最好的, 但并不总能成功地使用. 在分配一大块内存时, 可能竭尽全力也无法找到连续的内存块. 在用户空间中这不是问题,因为 ...
- windows环境下安装yaf框架
windows环境下安装yaf框架 在windows下安装yaf框架 准备工作: php环境(过程略,wamp,xampp,phpstudy都行,php版本大于5.3) git工具(需要从github ...
- windows下查看端口被占用及处理
一.通过命令行查找端口被谁占用 1.window+R组合键,调出命令窗口 2.输入命令:netstat -ano,列出所有端口的情况.在列表中我们观察被占用的端口 3.查看被占用端口对应的PID,输入 ...
- tcp、udp、ip、icmp报文格式分析
TCP .UDP .IP. ICMP协议报文格式分析 Tcp报文格式: Wireshark抓包如图: 源端口/目的端口(16bit): 在TCP报文中包涵了源端口/目的端口,源端口标识了发送进程,目的 ...
- Python基础之迭代器和生成器
阅读目录 楔子 python中的for循环 可迭代协议 迭代器协议 为什么要有for循环 初识生成器 生成器函数 列表推导式和生成器表达式 本章小结 生成器相关的面试题 返回顶部 楔子 假如我现在有一 ...
- Linux中Tomcat设置开机启动
设置方法 1.修改/etc/rc.d/rc.local,使用vi /etc/rc.d/rc.local 命令 2.在/etc/rc.d/rc.local文件最后添加下面两行脚本 export JAVA ...
- CF786B Legacy(线段树优化建图)
嘟嘟嘟 省选Day1T2不仅考了字符串,还考了线段树优化建图.当时不会,现在赶快学一下. 线段树能优化的图就是像这道题一样,一个点像一个区间的点连边,或一个区间像一个点连边.一个个连就是\(O(n ^ ...
- windows下搭建nginx+php+laravel开发环境(转)
1.前言 windows下大多我们都是下载使用集成环境,但是本地已经存在一个集成环境,但不适合项目的需求.因此准备再自己搭建一个环境. 2.准备 工具: 1) 下载 nginx1.14.0(版本根据自 ...
- 初学Kafka工作原理流程介绍
Apache kafka 工作原理介绍 消息队列技术是分布式应用间交换信息的一种技术.消息队列可驻留在内存或磁盘上, 队列存储消息直到它们被应用程序读走.通过消息队列,应用程序可独立地执行--它们不需 ...
- SpringBoot开发案例之拦截器注入Bean
前言 由于业务需要,需要在拦截器中操作Redis缓存,按照 controller,service层配置发现无法注入,一直报空指针异常. 解决方案 @Configuration public class ...