Deployment in version "v1" cannot be handled as a Deployment:

10/17/2019

helm install failing with the below error

command

helm install --name helloworld helm

Below is the error once I ran above command

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|...

Below is the deployment.yaml file i feel the issue in liveness and probeness configuration .

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
-- Pandit Biradar
kubernetes
kubernetes-deployment
kubernetes-helm

1 Answer

10/17/2019

The problem seems to be related to the libvenessProbe and readynessProbe that are both wrong.

An example of livenessProbe of http from the documentation here is:

livenessProbe

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

Your yamls if you only want to have a check of the port should be like:

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
-- wolmi
Source: StackOverflow