我正在寻找一种在 configmap 的数据部分获取环境变量的方法。在下面的 yml 配置中,我分配了 $NODE_NAME 这对我没有帮助。有什么办法可以完成这项工作吗
apiVersion: v1
kind: ConfigMap
metadata:
name: config
namespace: kube-system
data:
test.conf: |
{
"push": 5,
"test": $NODE_NAME
}
Run Code Online (Sandbox Code Playgroud) 我使用的yaml如下所示
apiVersion: v1
kind: Service
metadata:
name: xxx-svc
labels:
app: xxxxxx
spec:
type: NodePort
ports:
- port: 8080
selector:
app: xxxxxx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-xxx
labels:
app: xxxxxx
spec:
selector:
matchLabels:
app: xxxxxx
template:
metadata:
labels:
app: xxxxxx
spec:
containers:
- name: xxxxxx
image: yyy/xxxxxx:latest
ports:
- containerPort: 8080
resources:
requests:
cpu: "100m"
memory: "504Mi"
limits:
cpu: "100m"
memory: "504Mi"
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: xxxxxx
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-xxx …Run Code Online (Sandbox Code Playgroud) 我已经在我的集群中设置了 kube-prometheus(https://github.com/coreos/prometheus-operator/tree/master/contrib/kube-prometheus)。它包含一些默认警报,如“CoreDNSdown 等”。如何创建我自己的警报?
任何人都可以为我提供示例示例来创建将向我的 Gmail 帐户发送电子邮件的警报吗?
当 docker container pod is in Error 或 CarshLoopBackOff kubernetes 时,我遵循了这个警报。但我无法让它发挥作用。