gpt4 book ai didi

kubernetes - 如何在 kubernetes 的 alertmanager pod 中安装 curl

转载 作者:行者123 更新时间:2023-12-02 11:32:08 29 4
gpt4 key购买 nike

我想像这样在 alertmanger pod 中使用 curl:

curl www.google.com
它显示 ash: curl: not found ,所以我想安装 curl:
/alertmanager # apk add curl
ash: apk: not found
/alertmanager # yum install curl
ash: yum: not found
/alertmanager # apt install curl
ash: apt: not found
/alertmanager # apt-get install curl
ash: apt-get: not found
那么我应该怎么做才能在这个 pod 中安装 curl?这是我的 yaml:
kind: Deployment
apiVersion: apps/v1
metadata:
name: alertmanager
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: Reconcile
k8s-app: alertmanager
kubernetes.io/cluster-service: 'true'
version: v0.14.0
annotations:
deployment.kubernetes.io/revision: '1'
spec:
replicas: 1
selector:
matchLabels:
k8s-app: alertmanager
version: v0.14.0
template:
metadata:
creationTimestamp: null
labels:
k8s-app: alertmanager
version: v0.14.0
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
volumes:
- name: config-volume
configMap:
name: alertmanager-config
defaultMode: 420
- name: storage-volume
persistentVolumeClaim:
claimName: alertmanager
containers:
- name: prometheus-alertmanager
image: 'prom/alertmanager:v0.14.0'
args:
- '--config.file=/etc/config/alertmanager.yml'
- '--storage.path=/data'
- '--web.external-url=/'
ports:
- containerPort: 9093
protocol: TCP
resources:
limits:
cpu: 10m
memory: 50Mi
requests:
cpu: 10m
memory: 50Mi
volumeMounts:
- name: config-volume
mountPath: /etc/config
- name: storage-volume
mountPath: /data
readinessProbe:
httpGet:
path: '/#/status'
port: 9093
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 30
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
- name: prometheus-alertmanager-configmap-reload
image: 'jimmidyson/configmap-reload:v0.1'
args:
- '--volume-dir=/etc/config'
- '--webhook-url=http://localhost:9093/-/reload'
resources:
limits:
cpu: 10m
memory: 10Mi
requests:
cpu: 10m
memory: 10Mi
volumeMounts:
- name: config-volume
readOnly: true
mountPath: /etc/config
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
priorityClassName: system-cluster-critical
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

最佳答案

看着Dockerfile它使用的警报管理器 busybox它没有安装任何包管理器。你有两个选择

  • 如果可能,请使用 wget而不是 curl
  • 修改alert manager的Dockerfile使用alpine而不是 busybox并从修改后的 Dockerfile 构建您自己的 docker 镜像。 Alpine 自带apk可用于安装的包管理器 curl来自 apk add curl命令。
  • 关于kubernetes - 如何在 kubernetes 的 alertmanager pod 中安装 curl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63867090/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com