下面是部署中Pod的清单:
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus-deployment
namespace: monitoring
labels:
app: prometheus
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
annotations:
version: "1"
spec:
containers:
- name: prometheus-server
image: prom/prometheus:v2.9.2
imagePullPolicy: "IfNotPresent"
args:
- --config.file=/etc/config/prometheus.yml
- --storage.tsdb.path=/data
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
volumeMounts:
- name: config-volume
mountPath: /etc/config/prometheus.yml
subPath: prometheus.yml
- name: prometheus-data
mountPath: /data
subPath: ""
resources:
limits:
cpu: 200m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
ports:
- containerPort: 9090
readinessProbe:
httpGet:
path: /-/ready
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
livenessProbe:
httpGet:
path: /-/healthy
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 65534
volumes:
- name: config-volume
configMap:
name: prometheus-config
- name: prometheus-data
emptyDir: {}配置prometheus-config的位置如下所示:
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
namespace: monitoring
data:
prometheus.yml: |
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090运行Pod(prometheus-server)?时,
prometheus-config,使之可见。configMap:是否覆盖/etc/prometheus/prometheus.yml(如果有的话)的内容?发布于 2021-10-20 16:29:45
除非部署的ConfigMap引用标记为“可选”,否则在创建过氧化物酶时需要存在ConfigMap。
volumes:
- name: config-volume
configMap:
name: prometheus-config
optional: true在可选引用的ConfigMap在POD创建后存在的情况下,Kubernetes周期性同步将更新卷中的投影内容。Kubernates文档暗示了可能需要的时间。
Kubelet检查安装的ConfigMap是否在每一个周期同步中都是新的。但是,它使用基于本地TTL的缓存来获取ConfigMap的当前值.因此,从更新ConfigMap的那一刻到新键投射到吊舱的那一刻的总延迟可以长达kubelet同步周期(默认情况下为1分钟)+ ConfigMaps缓存的TTL (默认情况下为1分钟)。您可以通过更新pod的一个注释来触发立即刷新。
在文档中没有引用以下内容:更新现有ConfigMap的值将更新容器的卷挂载或ENV。
https://stackoverflow.com/questions/69649243
复制相似问题