一体化监控管理平台解决方案,一体化监控管理平台的应用范围
679
2022-10-15
kubernetes核心实战(六)--- ConfigMap
8、ConfigMap
抽取应用配置,并且可以自动更新
创建配置文件
[root@k8s-master-node1 ~/yaml/test]# vim configmap.yaml[root@k8s-master-node1 ~/yaml/test]# cat configmap.yaml apiVersion: v1data: redis.conf: | appendonly yeskind: ConfigMapmetadata: name: redis-conf namespace: default[root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# kubectl apply -f configmap.yaml configmap/redis-conf created[root@k8s-master-node1 ~/yaml/test]#
查看配置
[root@k8s-master-node1 ~/yaml/test]# kubectl get configmaps NAME DATA AGEkube-root-ca.crt 1 110mredis-conf 1 18s[root@k8s-master-node1 ~/yaml/test]#
9、DaemonSet
DaemonSet 确保全部(或者某些)节点上运行一个 Pod 的副本。当有节点加入集群时, 也会为他们新增一个 Pod 。当有节点从集群移除时,这些 Pod 也会被回收。删除 DaemonSet 将会删除它创建的所有 Pod。
DaemonSet 的一些典型用法:
在每个节点上运行集群存守护进程在每个节点上运行日志收集守护进程在每个节点上运行监控守护进程一种简单的用法是为每种类型的守护进程在所有的节点上都启动一个 DaemonSet。一个稍微复杂的用法是为同一种守护进程部署多个 DaemonSet;每个具有不同的标志, 并且对不同硬件类型具有不同的内存、CPU 要求。
创建
[root@k8s-master-node1 ~/yaml/test]# vim daemonset.yaml[root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# cat daemonset.yaml apiVersion: apps/v1kind: DaemonSetmetadata: name: redis-app labels: k8s-app: redis-appspec: selector: matchLabels: name: fluentd-redis template: metadata: labels: name: fluentd-redis spec: tolerations: # this toleration is to have the daemonset runnable on master nodes # remove it if your masters can't run pods - key: node-role.kubernetes.io/master effect: NoSchedule containers: - name: fluentd-redis image: redis command: - redis-server - "/redis-master/redis.conf" #指的是redis容器内部的位置 ports: - containerPort: 6379 resources: limits: memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: - name: data mountPath: /data - name: config mountPath: /redis-master readOnly: true terminationGracePeriodSeconds: 30 volumes: - name: data emptyDir: {} - name: config configMap: name: redis-conf items: - key: redis.conf path: redis.conf[root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# kubectl apply -f daemonset.yaml daemonset.apps/redis-app created[root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]#
查看
[root@k8s-master-node1 ~/yaml/test]# [root@k8s-master-node1 ~/yaml/test]# kubectl get podNAME READY STATUS RESTARTS AGEingress-demo-app-694bf5d965-8rh7f 1/1 Running 0 130mingress-demo-app-694bf5d965-swkpb 1/1 Running 0 130mnfs-client-provisioner-dc5789f74-5bznq 1/1 Running 0 114mredis-app-86g4q 1/1 Running 0 28sredis-app-rt92n 1/1 Running 0 28sredis-app-vkzft 1/1 Running 0 28sweb-0 1/1 Running 0 64mweb-1 1/1 Running 0 63mweb-2 1/1 Running 0 63m[root@k8s-master-node1 ~/yaml/test]# kubectl get daemonsets.apps NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGEredis-app 3 3 3 3 3
https://blog.csdn.net/qq_33921750
https://my.oschina.net/u/3981543
https://zhihu.com/people/chen-bu-yun-2
https://segmentfault.com/u/hppyvyv6/articles
https://juejin.cn/user/3315782802482007
https://space.bilibili.com/352476552/article
https://cloud.tencent.com/developer/column/93230
知乎、CSDN、开源中国、思否、掘金、哔哩哔哩、腾讯云
发表评论
暂时没有评论,来抢沙发吧~