Kubernetes k3s家庭助理配置

Kubernetes k3s家庭助理配置,kubernetes,raspberry-pi4,k3s,home-assistant,Kubernetes,Raspberry Pi4,K3s,Home Assistant,我已经为home assistant创建了以下一组yaml文件。我喜欢用yaml来控制舵机,因为我发现它给了我更多的控制。我遇到的问题是,它被困在挂起模式。对于上下文,我已经设置了一个节点关联,这样它就可以在插入zwave棒的情况下命中节点。节点是raspberry pi 4-8gb。下面是配置文件 apiVersion: apps/v1 kind: Deployment metadata: annotations: kompose.cmd: kompose convert

我已经为home assistant创建了以下一组yaml文件。我喜欢用yaml来控制舵机,因为我发现它给了我更多的控制。我遇到的问题是,它被困在挂起模式。对于上下文,我已经设置了一个节点关联,这样它就可以在插入zwave棒的情况下命中节点。节点是raspberry pi 4-8gb。下面是配置文件

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
迄今为止已完成的故障排除: 显而易见的启动、停止、重启集群和节点

SS-MacBook:homeassistant ss$ kubectl get pods -n homeassistant
NAME                             READY   STATUS    RESTARTS   AGE
homeassistant-78b4dd6c7d-sjw5n   0/1     Pending   0          8m9s
下面是日志的输出

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

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

因此,在事件发生后,显然有一个卷存在问题,但是我已经进行了三次检查,卷存在,并且没有绑定到其他卷。有什么想法吗?

您的pvc homeassistant pv时间访问模式与您为其准备的持久卷的访问模式不匹配。PVC具有ReadOnlyMany和PersistentVolume作为ReadWriteOnce.Hello@SKS81。上述问题解决了吗?嗨@WytrzymałyWiktor谢谢你的帮助。事实上,我最终使用了长角枪,效果非常好。非常感谢。