Kubernetes(k8s)部署Prometheus(普罗米修斯)编辑DaemonSet类型管理Pod网络

1.DaemonSet是每个worker节点上只能运行一个副本。

2.编辑部署Prometheus(普罗米修斯)的yaml

# vi node.yml

apiVersion: apps/v1
kind: DaemonSet
metadata:
 name: node
spec:
 selector:
  matchLabels:
   app: node-prometheus
 template:
  metadata:
   labels:
    app: node-prometheus
  spec:
   hostNetwork: true
   containers:
   - name: node-prom
     image: prom/prometheus
     imagePullPolicy: IfNotPresent
     ports:
      - containerPort: 9090
     volumeMounts:
     - name: proc
       mountPath: /host/proc
     - name: sys
       mountPath: /host/sys
     - name: root
       mountPath: /rootfs
   volumes:
   - name: proc
     hostPath:
      path: /proc
   - name: sys
     hostPath:
      path: /sys
   - name: root
     hostPath:
      path: /

3.部署Prometheus的yaml格式

# kubectl apply -f node.yml 
daemonset.apps/node created

 4.查看Pod网络

# kubectl get pod -o wide
NAME                     READY   STATUS    RESTARTS   AGE   IP            NODE       NOMINATED NODE   READINESS GATES
node-fss4c               1/1     Running   0          3s    172.25.0.20   computer              
node-shlcq               1/1     Running   0          3s    172.25.0.30   storage               

5.用浏览器查看,输入IP:9090

Kubernetes(k8s)部署Prometheus(普罗米修斯)编辑DaemonSet类型管理Pod网络_第1张图片

 

Kubernetes(k8s)部署Prometheus(普罗米修斯)编辑DaemonSet类型管理Pod网络_第2张图片 

你可能感兴趣的:(Kubernetes的学习)