k8s常用configmap配置文件

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: nginx-demo
name: nginx-demo
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-demo
template:
metadata:
labels:
app.kubernetes.io/name: nginx-demo
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9113"
spec:
containers:
- image: nginxdemos/hello:latest
name: nginx-demo
ports:
- name: http
containerPort: 80
volumeMounts:
- name: config-volume
mountPath: /etc/nginx/conf.d/status.conf
subPath: status.conf
- image: nginx/nginx-prometheus-exporter:latest
name: nginx-prometheus-exporter
args:
- "--nginx.scrape-uri=http://localhost:8080/stub_status"
ports:
- name: metrics
containerPort: 9113
volumes:
- name: config-volume
configMap:
name: status-config
---
apiVersion: v1
kind: Service
metadata:
name: nginx-demo
spec:
type: NodePort
selector:
app.kubernetes.io/name: nginx-demo
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
- port: 9113
targetPort: 9113
name: metrics
---
apiVersion: v1
kind: ConfigMap
metadata:
name: status-config
data:
status.conf: |-
server {
listen 8080;

location /stub_status {
stub_status;
}

}
posted @   技术颜良  阅读(23)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
历史上的今天:
2023-11-05 k8s集群中namespace状态一直显示Terminating如何解决?
2023-11-05 go语言Context应用全讲解
2023-11-05 使用Gorm进行高级查询
2021-11-05 RabbitMQ——使用Shovel插件迁移队列数据
2021-11-05 rabbitMQ故障恢复的顺序(重要)
2020-11-05 prometheus各种告警规则
2018-11-05 国内k8s集群部署的几种方式
点击右上角即可分享
微信分享提示