Kubernetes的pod控制器之DaemonSet
DaemonSet 顶级参数介绍
[root@master manifests]# kubectl explain ds
KIND: DaemonSet
VERSION: extensions/v1beta1 DESCRIPTION:
DEPRECATED - This group version of DaemonSet is deprecated by
apps/v1beta2/DaemonSet. See the release notes for more information.
DaemonSet represents the configuration of a daemon set. FIELDS:
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's metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata spec <Object> 期望状态
The desired behavior of this daemon set. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status status <Object>
The current status of this daemon set. This data may be out of date by some
window of time. Populated by the system. Read-only. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
控制spec的参数
[root@master manifests]# kubectl explain ds.spec
KIND: DaemonSet
VERSION: extensions/v1beta1 RESOURCE: spec <Object> DESCRIPTION:
The desired behavior of this daemon set. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status DaemonSetSpec is the specification of a daemon set. FIELDS:
minReadySeconds <integer> 启动后等待多久应用可以就绪
The minimum number of seconds for which a newly created DaemonSet pod
should be ready without any of its container crashing, for it to be
considered available. Defaults to 0 (pod will be considered available as
soon as it is ready). revisionHistoryLimit <integer> 保留的历史版本
The number of old history to retain to allow rollback. This is a pointer to
distinguish between explicit zero and not specified. Defaults to 10. selector <Object>
A label query over pods that are managed by the daemon set. Must match in
order to be controlled. If empty, defaulted to labels on Pod template. More
info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors template <Object> -required-
An object that describes the pod that will be created. The DaemonSet will
create exactly one copy of this pod on every node that matches the
template's node selector (or on every node if no node selector is
specified). More info:
https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template templateGeneration <integer>
DEPRECATED. A sequence number representing a specific generation of the
template. Populated by the system. It can be set only during the creation. updateStrategy <Object> 更新策略
An update strategy to replace existing DaemonSet pods with new pods.
创建DaemonSet 控制器模板
[root@master manifests]# cat ds-demo.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: default
spec:
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app: redis
strategy:
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:4.0-alpine
ports:
- name: redis
containerPort: 6379
---
apiVersion: apps/v1
kind: DaemonSet
metadata: 元数据
name: myapp-ds
namespace: default
spec: 控制器期望状态
revisionHistoryLimit: 5 保留历史版本的个数
selector: 定义标签选择器
matchLabels: 标签选择器
app: myapp-ds 选定的标签
cx: ds
updateStrategy: 更新策略
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
template: pod 的定义
metadata: pod 元数据定义
labels: 定义标签
app: myapp-ds
cx: ds
name: myapp-ds pod的名字
namespace: default pod 名称空间
spec: pod 期望状态定义
containers: pod 里容器的定义
- name: filebea 容器名字
image: ikubernetes/filebeat:5.6.5-alpine 容器镜像的定义
env: 环境变量定义
- name: REDIS_HOST
value: redis.default.svc.cluster.local
- name: REDIS_LOG_LEVEL
value: info
运行pod
[root@master manifests]# kubectl apply -f ds-demo.yaml
deployment.apps/redis unchanged
daemonset.apps/myapp-ds configured
查看创建的pod
[root@master manifests]# kubectl get pods
NAME READY STATUS RESTARTS AGE
myapp-ds-b5hsx 1/1 Running 0 50s
myapp-ds-m7pss 1/1 Running 0 47s
redis-54f5db865-hcdwd 1/1 Running 0 17m
查看pod运行日志
[root@master manifests]# kubectl logs myapp-ds-m7pss
2019/08/11 16:12:21.734552 beat.go:297: INFO Home path: [/usr/local/bin] Config path: [/usr/local/bin] Data path: [/usr/local/bin/data] Logs path: [/usr/local/bin/logs]
2019/08/11 16:12:21.734604 beat.go:192: INFO Setup Beat: filebeat; Version: 5.6.5
2019/08/11 16:12:21.734771 metrics.go:23: INFO Metrics logging every 30s
2019/08/11 16:12:21.734940 redis.go:140: INFO Max Retries set to: 3
2019/08/11 16:12:21.734961 outputs.go:108: INFO Activated redis as output plugin.
2019/08/11 16:12:21.735038 publish.go:300: INFO Publisher name: myapp-ds-m7pss
2019/08/11 16:12:21.735169 async.go:63: INFO Flush Interval set to: 1s
2019/08/11 16:12:21.735178 async.go:64: INFO Max Bulk Size set to: 2048
2019/08/11 16:12:21.735332 modules.go:95: ERR Not loading modules. Module directory not found: /usr/local/bin/module
2019/08/11 16:12:21.735534 beat.go:233: INFO filebeat start running.
2019/08/11 16:12:21.735704 registrar.go:68: INFO No registry file found under: /var/log/containers/filebeat_registry. Creating a new registry file.
2019/08/11 16:12:21.736963 registrar.go:106: INFO Loading registrar data from /var/log/containers/filebeat_registry
2019/08/11 16:12:21.737003 registrar.go:123: INFO States Loaded from registrar: 0
2019/08/11 16:12:21.737028 crawler.go:38: INFO Loading Prospectors: 1
2019/08/11 16:12:21.737153 prospector_log.go:65: INFO Prospector with previous states loaded: 0
2019/08/11 16:12:21.737408 config.go:95: WARN DEPRECATED: document_type is deprecated. Use fields instead.
2019/08/11 16:12:21.737430 prospector.go:124: INFO Starting prospector of type: log; id: 11998382299604891537
2019/08/11 16:12:21.737438 crawler.go:58: INFO Loading and starting Prospectors completed. Enabled prospectors: 1
2019/08/11 16:12:21.737451 registrar.go:236: INFO Starting Registrar
2019/08/11 16:12:21.737470 sync.go:41: INFO Start sending events to output
2019/08/11 16:12:21.737498 spooler.go:63: INFO Starting spooler: spool_size: 2048; idle_timeout: 5s
2019/08/11 16:12:51.735339 metrics.go:39: INFO Non-zero metrics in the last 30s: registrar.writes=1
2019/08/11 16:13:21.736172 metrics.go:34: INFO No non-zero metrics in the last 30s
2019/08/11 16:13:51.735741 metrics.go:34: INFO No non-zero metrics in the last 30s
2019/08/11 16:14:21.736297 metrics.go:34: INFO No non-zero metrics in the last 30s
2019/08/11 16:14:51.736150 metrics.go:34: INFO No non-zero metrics in the last 30s
2019/08/11 16:15:21.735939 metrics.go:34: INFO No non-zero metrics in the last 30s
进入一个pod里面
[root@master manifests]# kubectl exec -it myapp-ds-m7pss -- /bin/sh
/ #
手动创建server
[root@master manifests]# kubectl expose deploy redis --port=6379
查看创建的server
[root@master manifests]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 17d
myapp NodePort 10.103.191.244 <none> 80:31339/TCP 17d
nginx ClusterIP 10.108.177.175 <none> 80/TCP 17d
redis ClusterIP 10.104.114.16 <none> 6379/TCP 8m41s
Kubernetes的pod控制器之DaemonSet的更多相关文章
- 十六、资源控制器之DaemonSet
资源控制器之DaemonSet DaemonSet 确保全部(或者一些) Node上运行一个 Pod 的副本,当有 Node 加入集群时,也会为他们新增一个 Pod,当有 Node 从集群移除时,这些 ...
- kubernetes控制器之DaemonSet
转载于https://blog.csdn.net/bbwangj/article/details/82867472 什么是 DaemonSet? DaemonSet 确保全部(或者一些)Node 上运 ...
- Kubernetes---资源控制器之DaemonSet、Job和CronJob
⒈DaemonSet介绍,什么是DaemonSet DaemonSet 确保全部(或者一些)Node 上运行一个Pod的副本[注意主节点并不会参加调度].当有 Node 加入集群时,也会为他们新增一个 ...
- Kubernetes之Pod使用
一.什么是Podkubernetes中的一切都可以理解为是一种资源对象,pod,rc,service,都可以理解是 一种资源对象.pod的组成示意图如下,由一个叫”pause“的根容器,加上一个或多个 ...
- Kubernetes的pod控制器及ReplicaSet控制器类型的pod的定义
为什么需要Pod Kubernetes项目之所以这么做的原因: 因为Kubernetes是谷歌公司基于Borg项目做出来的,谷歌工程师发现,他们部署的应用往往存在这进程与进程组的关系.具体说呢,就是这 ...
- 06 . Kubernetes之Pod控制器详细介绍及应用
Pod API属性详解 Pod是k8s集群中的最小编排单位.将这个设计落实到API对象上,容器就成了Pod属性里一个普通的字段.那么到底哪些属性属于Pod对象,哪些属性属于容器的呢?先看下面的一段描述 ...
- Kubernetes K8S之资源控制器Daemonset详解
Kubernetes的资源控制器Daemonset详解与示例 主机配置规划 服务器名称(hostname) 系统版本 配置 内网IP 外网IP(模拟) k8s-master CentOS7.7 2C/ ...
- 浅入Kubernetes(10):控制节点的部署,选择器、亲和性、污点
目录 标签和nodeSelector 标签选择 亲和性和反亲和性 污点和容忍度 系统默认污点 容忍度 DaemonSet 在前面的学习中,我们学到了 Deployment 部署,以及副本数(Repli ...
- Kubernetes基石-pod容器
引用三个问题来叙述Kubernetes的pod容器 1.为什么不直接在一个Docker容器中运行所有的应用进程. 2.为什么pod这种容器中要同时运行多个Docker容器(可以只有一个) 3.为什么k ...
随机推荐
- [Reversal 剧情设计] 第一章——不速之客
夜.草叶上渗出的晶莹水珠反射着清冷的月光,但随后就暗淡下来——一个身披黑色大衣的男人无声地经过,腰间的长剑隐约露出剑柄. 远处是一个静谧的小山村,少有外人来往,此时正值深夜,家家户户都熄灭了油灯,只有 ...
- 题解 【Codeforces755A】 PolandBall and Hypothesis
我们可以发现,当n>2时,n·(n-2)+1=(n-1)·(n-1),因此,输出n-2即可. 如果n<=2,我们可以发现: 当n=2时,2·4+1=9不是质数,输出4即可: 当n=1时,1 ...
- testng如何实现用例间依赖
todo: 参考: https://www.cnblogs.com/znicy/p/6534893.html
- Documents
centos 7 修改主机名 hostnamectl set-hostname myhostname ansible node -m raw -a "if [[ \$(cat /root/. ...
- Linux gd库安装步骤说明
gd 库是 PHP 处理图形的扩展库,它提供了一系列用来处理图片的 API(应用程序编程接口),使用 gd 库可以处理图片或者生成图片.在网站上,gd 库通常用来生成缩略图,或者对图片加水印,或者生成 ...
- Unity Hub破解
1.退出UnityHub,安装好nodejs后,用Win+R输入"cmd"执行以下命令 npm install -g asar 2.打开UnityHub安装目录如 C:\Progr ...
- idea中运行ssm 或springboot项目时,project Structure的配置
ctrl+alt+shift+s进入 project Structure 首先是project选项 Modules 标明source testsource 以及 resource 和 testreso ...
- Java进阶学习(5)之设计原则(上)
设计原则 城堡游戏 扩展 字符串被分割 String line = in.nextLine(); String[] words = line.split(" "); 消除代码复制 ...
- [爬坑记录] Qt 代码卡住 不发信号 不触发槽
先让我激动一会儿 [捂脸] 最近在用Qt做个程序 用来参加比赛 期间总共遇到两次如标题的问题 也即是 莫名其妙的不触发槽函数了 而且原因也不一样 {先说明 我学习Qt依旧只是入门级 也许入不了大佬法眼 ...
- 题解【洛谷P2279】[HNOI2003]消防局的设立
题目描述 2020年,人类在火星上建立了一个庞大的基地群,总共有\(n\)个基地.起初为了节约材料,人类只修建了\(n-1\)条道路来连接这些基地,并且每两个基地都能够通过道路到达,所以所有的基地形成 ...