我为家庭助理创建了以下一组 yaml 文件。我喜欢在 helm 上使用 yaml,因为我发现它给了我更多的控制权。我遇到的问题是它卡在挂起模式。对于上下文,我设置了一个节点亲和性,以便它在插入 zwave 棒的情况下击中节点。节点是树莓派 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
因此,在事件发生后,卷显然存在问题,但是我进行了三次检查,卷存在并且尚未绑定到其他内容。有任何想法吗?