google-home-k8s
google-home-k8s copied to clipboard
Google Home Kubernetes Action
Google Home Action to communicate with Kubernetes
This project allows you to connect your Google Home to your Kubernetes cluster and control it via voice commands. It's not a public Google Home Action, since you have to configure Kubernetes access manually for your cluster.
This repository contains Dialogflow configuration as well, which can be imported into existing project. It can be customized later.
Example conversation:
[you] Hey Google, talk to Kubernetes Manager
[assistant] Welcome to Kubernetes Manager. How can I help you?
[you] Scale statefulset "redis"
[assistant] Got it. Currently, there are 3 replicas of the "redis" statefulset. To how many replicas do you want to scale?
[you] 5
[assistant] Statefulset has been updated. Anything else?
Supported voice commands
Scale statefulset "name"
Scale deployment "name"
Scale replicaset "name"
What is the size of the cluster?
Contribute to add more voice commands :)
How it works
Generate kubeconfig
To generate kubeconfig
you have to install the following tools:
-
kubectl
-
cfssl
-
cfssljson
Then run the following command to generate build/kubeconfig
file.
./generate-kubeconfig.sh
Deploy to Google App Engine
Requirements:
-
gcloud
Set environment variables in env.yaml
(cp env.sample.yaml env.yaml
).
gcloud app deploy
Save URL, you will need to use it later in Dialogflow.
API deployed to App Engine is protected by static API Key which should be set in env.yaml
. To access API, client should send Authorization: Bearer ${API_KEY}
header.
Configure in Dialogflow
- Go to Dialogflow Console
- Select or create a new agent
- Go to Settings -> Export and Import
- Select Import From Zip (import this file google-home-k8s.zip)
- Go to Fulfillment
- Enable Webhook
- Paste URL to API deployed to App Engine
- Add Header. Key:
Authorization
, Value:Bearer API_KEY
(replaceAPI_KEY
with the value fromenv.yaml
)
Unit Tests
GO111MODULE=on go test -mod vendor -race -v ./pkg/...