我用Helm安装失败,出现以下错误
安装命令:
helm install --name helloworld helm
一旦我在运行上面的命令,就报错:
Error: release usagemetrics failed: Deployment in version "v1" cannot be handled as a Deployment: v1.Deployment.Spec: v1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.Containers: []v1.Container: v1.Container.LivenessProbe: readObjectStart: expect { or n, but found 9, error found in #10 byte of ...|ssProbe":9001,"name"|..., bigger context ...|"imagePullPolicy":"IfNotPresent","livenessProbe":9001,"name":"usagemetrics-helm","ports":[{"containe|...
以下是deployment.yaml
文件,我感觉liveness和probeness配置存在问题。
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-helm
spec:
replicas: 1
selector:
matchLabels:
app: release-name-helm
release: release-name
template:
metadata:
labels:
app: release-name-helm
release: release-name
spec:
containers:
- name: release-name-helm
imagePullPolicy: IfNotPresent
image: hellworld
ports:
- name: "http"
containerPort: 9001
envFrom:
- configMapRef:
name: release-name-helm
- secretRef:
name: release-name-helm
livenessProbe:
9001
readinessProbe:
9001
问题应该跟
libvenessProbe
和readynessProbe
都错误有关。http的
livenessProbe
的示例是:livenessProbe httpGet: path: /healthz port: 8080 httpHeaders: - name: Custom-Header value: Awesome initialDelaySeconds: 3 periodSeconds: 3
如果你只需要检查port,则yaml应如下所示:
apiVersion: apps/v1 kind: Deployment metadata: name: release-name-helm spec: replicas: 1 selector: matchLabels: app: release-name-helm release: release-name template: metadata: labels: app: release-name-helm release: release-name spec: containers: - name: release-name-helm imagePullPolicy: IfNotPresent image: hellworld ports: - name: "http" containerPort: 9001 envFrom: - configMapRef: name: release-name-helm - secretRef: name: release-name-helm livenessProbe: tcpSocket: port: 9001 initialDelaySeconds: 5 periodSeconds: 10 readinessProbe: tcpSocket: port: 9001 initialDelaySeconds: 5 periodSeconds: 10
你的答案