2

helm install 失败并出现以下错误

命令

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
4

1 回答 1

5

问题似乎与livenessProbereadynessProbe都是错误的有关。

此处livenessProbe文档中的 http示例是:

livenessProbe

  httpGet:
    path: /healthz
    port: 8080
    httpHeaders:
      - name: Custom-Header
        value: Awesome
    initialDelaySeconds: 3
    periodSeconds: 3

如果您只想检查端口,您的 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
于 2019-10-17T07:33:17.683 回答