This is a custom component for monitoring your Kubernetes cluster with Home Assistant.
~/.kube/config
or /etc/kubernetes/admin.conf
on your master node)The integration will create a seperate sensor for each Kubernetes component. Following components are supported at the moment:
The sensors will be named with this schema: kindnamespacename. 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.
The integration provides a few service for managing Kubernetes
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
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