我想在alertmanger pod中使用curl,如下所示:
curl www.google.com
Run Code Online (Sandbox Code Playgroud)
它显示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
Run Code Online (Sandbox Code Playgroud)
那么我应该怎么做才能在这个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
Run Code Online (Sandbox Code Playgroud)
查看它使用的警报管理器的Dockerfilebusybox,它没有安装任何包管理器。你有两个选择
wget代替curlalpine代替使用busybox并从修改后的 Dockerfile 构建您自己的 docker 映像。alpine 附带包管理器,可以通过命令apk安装。curlapk add curl| 归档时间: |
|
| 查看次数: |
2307 次 |
| 最近记录: |