Skip to content

Create kubernetes CronJob clean waste Deployment、Ingress、Services

Notifications You must be signed in to change notification settings

BigbigY/kubernetes-deployment-clean-cronjob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes-Deployment-Clean-CronJob

CircleCI

English | 中文

Kubernetes-Deployment-Clean-CronJob 结合Prometheus API 定时清理废弃deployment的任务计划。

Install

你需要安装glide来处理依赖

The easiest way to install the latest release on Mac or Linux is with the following script:

curl https://glide.sh/get | sh

On Mac OS X you can also install the latest release via Homebrew:

$ brew install glide

On Ubuntu Precise (12.04), Trusty (14.04), Wily (15.10) or Xenial (16.04) you can install from our PPA:

sudo add-apt-repository ppa:masterminds/glide && sudo apt-get update
sudo apt-get install glide

构建Kubernetes-Deployment-Clean-CronJob

1.安装依赖

make dep

2.构建二进制文件跨平台编译需要指定 mac-build linux-build win-build

make build

你也可以直接make all, 它包含了depbuild

构建docker image, 在此之前你需要安装依赖

make build-docker

清除所有构建内容

make clean

使用(Usage)

Usage of ./bin/cleanDeployment:
  -web_url string
        (must)HTTP API URL
  • web_url: Prometheus API URL

注意

只能在kubernetes集群内部运行, 如果你需要指定kubeconfig的版本, 那么请看exmple中的cleanDeployment.go文件