Home assistant config for k3s

5/1/2021

I've created the following set of yaml files for home assistant. I like using yaml over helm because I find it gives me more control. The issue i'm having is that it is stuck in pending mode. For context i've set up a node affinity such that it hits the node with the zwave stick plugged into it. The nodes are raspberry pi 4 - 8gb. Here are the config files

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: homeassistant
  name: homeassistant
  namespace: homeassistant
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: homeassistant
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.22.0 (955b78124)
      labels:
        io.kompose.service: homeassistant
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - masternode
      containers:
        - env:
            - name: DISABLE_JEMALLOC
              value: "1"
          image: homeassistant/raspberrypi4-homeassistant:stable
          name: homeassistant
          ports:
            - containerPort: 8123
          resources: {}
          volumeMounts:
            - mountPath: /config
              name: homeassistant-pv-config
            - mountPath: /etc/localtime
              name: homeassistant-pv-time
              readOnly: true
      restartPolicy: Always
      volumes:
        - name: homeassistant-pv-config
          persistentVolumeClaim:
            claimName: homeassistant-pv-config
        - name: homeassistant-pv-time
          persistentVolumeClaim:
            claimName: homeassistant-pv-time
            readOnly: true
status: {}
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: homeassistant
  name: homeassistant
  namespace: homeassistant
spec:
  ports:
    - name: "8123"
      port: 8123
      targetPort: 8123
  selector:
    io.kompose.service: homeassistant
status:
  loadBalancer: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: homeassistant-pv-config
  name: homeassistant-pv-config
  namespace: homeassistant
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: homeassistant-pv-time
  name: homeassistant-pv-time
  namespace: homeassistant
spec:
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 100Mi
status: {}
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: homeassistant-pv-config
  namespace: homeassistant
  labels:
    type: local
spec:
  storageClassName: local-path
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
     namespace: homeassistant
     name: homeassistant-pv-config
  hostPath:
    path: "/home/pi/Software/homeassistant/config"
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: homeassistant-pv-time
  namespace: homeassistant
  labels:
    type: local
spec:
  storageClassName: local-path
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
     namespace: homeassistant
     name: homeassistant-pv-time
  hostPath:
    path: "/home/pi/Software/homeassistant/localtime"
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: homeassistant-ingress
  namespace: homeassistant
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
  rules:
  - host: homeassistant.local
    http:
      paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: homeassistant
              port: 
                number: 8123

Troubleshooting done so far: The obvious start, stop restart cluster and the nodes

SS-MacBook:homeassistant ss$ kubectl get pods -n homeassistant
NAME                             READY   STATUS    RESTARTS   AGE
homeassistant-78b4dd6c7d-sjw5n   0/1     Pending   0          8m9s

Here is the output for logs

SS-MacBook:homeassistant ss$ kubectl logs homeassistant-78b4dd6c7d-sjw5n -n homeassistant
No output shows up

Events:

SS-MacBook:homeassistant ss$ kubectl get events -n homeassistant
LAST SEEN   TYPE      REASON                OBJECT                                        MESSAGE
58m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            error while running "VolumeBinding" prebind plugin for pod "homeassistant-7bc457756f-5zg4w": Failed to bind volumes: timed out waiting for the condition
46m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            error while running "VolumeBinding" prebind plugin for pod "homeassistant-7bc457756f-5zg4w": Failed to bind volumes: timed out waiting for the condition
36m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            error while running "VolumeBinding" prebind plugin for pod "homeassistant-7bc457756f-5zg4w": Failed to bind volumes: timed out waiting for the condition
25m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            error while running "VolumeBinding" prebind plugin for pod "homeassistant-7bc457756f-5zg4w": Failed to bind volumes: timed out waiting for the condition
12m         Normal    WaitForPodScheduled   persistentvolumeclaim/homeassistant-pv-time   waiting for pod homeassistant-7bc457756f-5zg4w to be scheduled
10m         Normal    ScalingReplicaSet     deployment/homeassistant                      Scaled down replica set homeassistant-7bc457756f to 0
10m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            skip schedule deleting pod: homeassistant/homeassistant-7bc457756f-5zg4w
10m         Normal    SuccessfulDelete      replicaset/homeassistant-7bc457756f           Deleted pod: homeassistant-7bc457756f-5zg4w
10m         Normal    ScalingReplicaSet     deployment/homeassistant                      Scaled up replica set homeassistant-78b4dd6c7d to 1
10m         Warning   FailedScheduling      pod/homeassistant-7bc457756f-5zg4w            error while running "VolumeBinding" prebind plugin for pod "homeassistant-7bc457756f-5zg4w": Failed to bind volumes: timed out waiting for the condition
10m         Normal    SuccessfulCreate      replicaset/homeassistant-78b4dd6c7d           Created pod: homeassistant-78b4dd6c7d-sjw5n
2m55s       Normal    WaitForPodScheduled   persistentvolumeclaim/homeassistant-pv-time   waiting for pod homeassistant-78b4dd6c7d-sjw5n to be scheduled
38s         Warning   FailedScheduling      pod/homeassistant-78b4dd6c7d-sjw5n            error while running "VolumeBinding" prebind plugin for pod "homeassistant-78b4dd6c7d-sjw5n": Failed to bind volumes: timed out waiting for the condition

So after the events there is clearly an issue with a volume however i have triple checked and the volumes exist and are not already bound to something else. Any ideas?

-- SKS81
home-assistant
k3s
kubernetes
raspberry-pi4

0 Answers