-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k3s/kubernettes install #525
Conversation
Configmap to hold pw login and a few other things.
config map to auto add sun/moon to grafana
Deployment for grafana based on grafana's recommendation but using image used for normal install
pvc for grafana storage, should be updated to storage class being used by whoever deploys, and amount allocated should be updated to something reasonable when created.
service for grafana. I'm using metallb and this should be updated by whoever deploys to what they are using.
deployment for influxdb set to same version as main install method in repo
pvc for influxdb, should be updated to storageclass of whoever deploys and allocations adjusted.
service to expose influxdb to other pods via nodeport
file to set up namespace
deployment for pypowerwall. pulls config from configmap
pvc for pypowerwall
service to expose pypowerwall via nodeport
configmap for telegraf. accesses pypowerwall and influxdb via nodeport so that does not need to be changed, but tz does.
deployment for telegraf, it mounts the configmap to the file system as the conf file
config for weather411, only api/lat/lon need updating when setting up.
weather411 deployment. Mounts config as file.
service for weather411
Just some notes
Changed service to have an ip so the dashboard graphic can access it.
added env variables so that the embedded html works.
Hi @cfoos - Thanks for sharing this.
The power flow animation is a iframe in an html panel on Grafana that effectively renders this animation directly from pypowerwall - you can see an example of this hitting the pypowerwall endpoint at http://pypowerwall:8675/example.html - Does that help? |
I tracked down how it was being added, but it being an iframe and finding pypowerwall via browser connection complicated it since under k3s it would be a seperate ip/hostname. Manually setting that in the dashboard helped, but if you put it behind a proxy to get a domain name it breaks in chrome, probably due to xss. I found a plugin for powerflow and I'm re-doing a k3s dashboard using it and adjusting some of the deployments to have things like readiness probes. |
Added instructions to set up a test k3s on a single rpi 4.
local pvc for testing
local pvc for testing
modified dashboard for k3s. Also have pw2+ stuff removed since I only have the base 2 to test on.
metallb advertise for testing
metallb config for testing
pvc for testing
moved |
Formatting and order rewrite
The issue is that k3s runs everything in pods that have an internal to the cluster communication that is used to get the data from pypowerwall to influxdb then to grafana, but only services set up to be accessed externally can be. Because of that, for embedded html to get data from pypowerwall you need to add a service for external access to pypowerwall and update the embedded html to point to that services ip since your browser is not internal to k3s. Unless someone else knows how, I can't get metallb to allow different deployments/pods to share an ip. Because of that you end up with xss. You could add nginx in front of grafana as a reverse proxy so you can use a domain name and do the same for pypowerwall on a subdomain, but that gets even more complicated and harder to automate down the line. I think the best way to keep the old data would be to find a data source that can poll pypowerwall from grafana and send that data to a visualization. This seems like it may be the best datasource if we can run the js on pypowerwall and just push the update data. Basically, run the entire page on the pypowerwall container and push the soe, aggregates, etc to the streaming datasource and use that to live update a visualization that has everything else hard coded instead of fetched on first load. |
Thanks for the contribution @cfoos ! |
Here are the files I used to get this running on k3s. The one issue I have not fixed is that in grafana the powerflow graphic in the top right does not work. Everything else appears to work correctly.