
kubegreen/kube-green
!image
How many of your dev/preview pods stay on during weekends? Or at night? It's a waste of resources! And money! But fear not, kube-green is here to the rescue.
kube-green is a simple k8s addon that automatically shuts down (some of) your resources when you don't need them.
If you already use kube-green, add you as an adopter!
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See how to install the project on a live system in our docs.
Make sure you have Go installed (download). Version 1.19 or higher is required.
To have kube-green running locally just clone this repository and install the dependencies running:
golanggo get
There are different types of tests in this repository.
It is possible to run all the unit tests with
shmake test
To run integration tests:
shmake e2e-test
To deploy kube-green in live systems, follow the docs.
To run kube-green for development purpose, you can use ko to deploy
in a KinD cluster.
It is possible to start a KinD cluster running kind create cluster --name kube-green-development.
To deploy kube-green using ko, run:
shmake local-run clusterName=kube-green-development
The use of this operator is very simple. Once installed on the cluster, configure the desired CRD to make it works.
See here the documentation about the configuration of the CRD.
Pods running during working hours with Europe/Rome timezone, suspend CronJobs and exclude a deployment named api-gateway:
yamlapiVersion: kube-green.com/v1alpha1 kind: SleepInfo metadata: name: working-hours spec: weekdays: "1-5" sleepAt: "20:00" wakeUpAt: "08:00" timeZone: "Europe/Rome" suspendCronJobs: true excludeRef: - apiVersion: "apps/v1" kind: Deployment name: api-gateway
Pods sleep every night without restore:
yamlapiVersion: kube-green.com/v1alpha1 kind: SleepInfo metadata: name: working-hours-no-wakeup spec: sleepAt: "20:00" timeZone: Europe/Rome weekdays: "*"
To see other examples, go to our docs.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the release on this repository.
To upgrade the version:
make release version=v{{NEW_VERSION_TO_TAG}} where {{NEW_VERSION_TO_TAG}} should be replaced with the next version to upgrade. N.B.: version should include v as first char.git push --tags origin v{{NEW_VERSION_TO_TAG}}API reference is automatically generated with this tool. To generate it automatically, are added in api versioned folder a file doc.go with the content of file groupversion_info.go and a comment with +genclient in the sleepinfo_types.go file for the resource type.
This project is licensed under the MIT License - see the LICENSE file for details
Special thanks to JGiola for the tech review.
If you like or are using this project, please give it a star. Thanks!
Here the list of adopters of kube-green.
If you already use kube-green, add you as an adopter!
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务