云原生家庭网络(十四):部署智能家居助手 HomeAssistant

2024-05-27 10:01:39 浏览数 (1)

HomeAssistant 介绍

HomeAssistant 是一个开源的智能家居管理系统,通常是直接以操作系统形式安装到设备里,但也提供了容器化部署的方式,本文介绍将 HomeAssistant 部署到 Kubernetes 的方法。

开源项目

  • 项目地址: https://github.com/home-assistant/core
  • 官网: https://www.home-assistant.io/

目录结构

代码语言:txt复制
home-assistant
├── daemonset.yaml
└── kustomization.yaml

配置 daemonset.yaml

代码语言:yaml复制
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: home-assistant
  name: home-assistant
  namespace: default
spec:
  selector:
    matchLabels:
      app: home-assistant
  template:
    metadata:
      labels:
        app: home-assistant
    spec:
      terminationGracePeriodSeconds: 1
      containers:
        - image: homeassistant/home-assistant:stable
          imagePullPolicy: IfNotPresent
          name: home-assistant
          ports:
            - containerPort: 8123
              name: web
          env:
            - name: TZ
              value: Asia/Shanghai
          volumeMounts:
            - mountPath: /config
              name: config
            - mountPath: /run/dbus
              name: dbus
              readOnly: true
      dnsPolicy: Default
      hostNetwork: true
      restartPolicy: Always
      volumes:
        - name: config
          hostPath:
            path: /data/home-assistant/config
            type: DirectoryOrCreate
        - name: dbus
          hostPath:
            path: /run/dbus
  updateStrategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate

配置 kustomization.yaml

代码语言:yaml复制
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - daemonset.yaml

namespace: default

访问 HomeAssistant

访问入口:http://`路由器内网 IP`:8123/

0 人点赞