Git Product home page Git Product logo

home-assistant-kubernetes's Introduction

hacs_badge

Home Assistant Kubernetes Integration

This is a custom component for monitoring your Kubernetes cluster with Home Assistant.

Installation

  1. Install this Integration as a HACS custom repository or just copy the content of the release zip to your custom_components directory.
  2. Copy the config which you use to access your Kubernetes cluster to the config folder of your Home Assistant instace (usually you can find this file here: ~/.kube/config or /etc/kubernetes/admin.conf on your master node)
  3. Add the Integration in Home Assistant by navigating to Configuration -> Integrations -> Add Integration and search for kubernetes

Sensors

The integration will create a seperate sensor for each Kubernetes component. Following components are supported at the moment:

  • Nodes
  • Namespaces
  • Deployments
  • DaemonSets
  • Pods

The sensors will be named with this schema: kind_namespace_name. For example a Pod sensor could be named sensor.deployment_homeassistant_homeassistant_db You can find further details of the component in the attributes of the sensor. If you want to monitor specific details of a sensor you can create a template sensor like that:

{{ state_attr('sensor.daemonset_glances_glances', 'spec')["template"]["spec"]["containers"][0]["image"] }}

Each sensor will be created and deleted dynamically. For example if a deployments spawns another Pod, there will be another sensor in your Home-Assistant. If the Pod gets deleted, the sensor will be removed as well.

Services

The integration provides a few service for managing Kubernetes

set_unschedulable

Set the unschedulable flag of a Node. Attention this will not drain the node!

service: kubernetes.set_unschedulable
target:
  entity_id: sensor.node_pi02 data:
unschedulable: true

set_image_deployment / set_image_daemon_set

Sets the image of a Deployment or DaemonSet. This service acts like kubectl set image.

service: kubernetes.set_image_deployment
target:
  entity_id: sensor.deployment_homeassistant_homeassistant
data:
  container: homeassistant
  image: homeassistant/home-assistant:2021.10

home-assistant-kubernetes's People

Contributors

adi146 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

cerebrate

home-assistant-kubernetes's Issues

AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Hi!

I run into the following error when I enable this plugin via HACS. Kubernetes config file lies in the hass config folder.

Error setting up entry kubernetes for kubernetes

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/kubernetes/__init__.py", line 32, in async_setup_entry
    hass.config_entries.async_setup_platforms(entry, ["sensor"])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Version:
Home Assistant 2023.10.2
Supervisor 2023.11.3
Operating System 11.1
Frontend 20231005.0 - latest

Is there anything I can do?

BR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.