我试图通过定义显式公差来在污点节点上部署Alertmanager服务。
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertmanager
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: alertmanager
template:
metadata:
name: alertmanager
labels:
app: alertmanager
spec:
tolerations:
- key: "prometheusnew"
operator: "Equal"
value: "false"
effect: "NoExecute"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: placement_affinity
operator: In
values:
- prometheusnew
containers:
- name: alertmanager
image: prom/alertmanager:v0.15.3
args:
- '--config.file=/etc/alertmanager/config.yml'
- '--storage.path=/alertmanager'
ports:
- name: alertmanager
containerPort: 9093
volumeMounts:
- name: config-volume
mountPath: /etc/alertmanager
- name: alertmanager
mountPath: /alertmanager
volumes:
- name: config-volume
configMap:
name: alertmanager
- name: alertmanager
emptyDir: {}
可以从同一节点访问群集ip 172.30.148.104,但是不能从其他节点或不同节点中的pod来访问pod和服务ip。
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
alertmanager ClusterIP 172.30.148.104 <none> 9093/TCP 20m
Pod运行良好,如果部署时没有污染,则可以正常工作。 感谢任何帮助,谢谢。