(2022版)一套教程搞定k8s安装到实战 | DaemonSet
Posted COCOgsta
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(2022版)一套教程搞定k8s安装到实战 | DaemonSet相关的知识,希望对你有一定的参考价值。
视频来源:B站《(2022版)最新、最全、最详细的Kubernetes(K8s)教程,从K8s安装到实战一套搞定》
一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:(2022版)一套教程搞定k8s安装到实战 | 汇总_COCOgsta的博客-CSDN博客
创建一个ds
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: nginx
name: nginx
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx
template:
metadata:
creationTimestamp: null
labels:
app: nginx
spec:
containers:
- image: nginx:1.15.2
imagePullPolicy: IfNotPresent
name: nginx
resources:
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
terminationGracePeriodSeconds: 30
复制代码
[root@k8s-master-lb ~]# kubectl create -f nginx-ds.yaml
daemonset.apps/nginx created
[root@k8s-master-lb ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
busybox 1/1 Running 13 13h 172.17.125.4 k8s-node01 <none> <none>
nginx-66bbc9fdc5-mbqkf 1/1 Running 0 24h 172.18.195.1 k8s-master03 <none> <none>
nginx-66bbc9fdc5-x7vkl 1/1 Running 0 24h 172.17.125.3 k8s-node01 <none> <none>
nginx-dngrb 1/1 Running 0 20s 172.25.92.68 k8s-master02 <none> <none>
nginx-fm6tf 1/1 Running 0 20s 172.16.203.196 k8s-master-lb <none> <none>
nginx-fn9nn 1/1 Running 0 20s 172.18.195.2 k8s-master03 <none> <none>
nginx-jwhxh 1/1 Running 0 20s 172.27.14.196 k8s-node02 <none> <none>
nginx-t6fhw 1/1 Running 0 20s 172.17.125.5 k8s-node01 <none> <none>
web-0 1/1 Running 0 14h 172.27.14.195 k8s-node02 <none> <none>
web-1 1/1 Running 0 14h 172.16.203.195 k8s-master-lb <none> <none>
web-2 1/1 Running 0 14h 172.25.92.67 k8s-master02 <none> <none>
[root@k8s-master-lb ~]#
复制代码
更新与回滚
建议使用OnDelete更新方式,并配置标签,在符合标签的节点上才部署容器。
以上是关于(2022版)一套教程搞定k8s安装到实战 | DaemonSet的主要内容,如果未能解决你的问题,请参考以下文章
(2022版)一套教程搞定k8s安装到实战 | InitContainer
(2022版)一套教程搞定k8s安装到实战 | DaemonSet
(2022版)一套教程搞定k8s安装到实战 | Volumes