版本“ v1”中的部署不能作为部署处理:

时间:2019-10-17 06:50:01

标签: kubernetes kubernetes-helm kubernetes-deployment

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文件,我觉得配置和实时性方面存在问题。

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

1 个答案:

答案 0 :(得分:1)

该问题似乎与错误的libvenessProbereadynessProbe有关。

文档here中http的livenessProbe的示例是:

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