All Projects → jsenon → api-cni-cleanup

jsenon / api-cni-cleanup

Licence: Apache-2.0 license
Kubernetes CNI cleanner

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to api-cni-cleanup

cni-benchmarks
A simple program to benchmark various container networking (CNI) plugins.
Stars: ✭ 85 (+193.1%)
Mutual labels:  cni
Cilium
eBPF-based Networking, Security, and Observability
Stars: ✭ 10,256 (+35265.52%)
Mutual labels:  cni
Covscript
Covariant Script Interpreter
Stars: ✭ 169 (+482.76%)
Mutual labels:  cni
Kube Spawn
A tool for creating multi-node Kubernetes clusters on a Linux machine using kubeadm & systemd-nspawn. Brought to you by the Kinvolk team.
Stars: ✭ 392 (+1251.72%)
Mutual labels:  cni
Antrea
Kubernetes networking based on Open vSwitch
Stars: ✭ 964 (+3224.14%)
Mutual labels:  cni
K Vswitch
k-vswitch is an easy-to-operate, performant and secure Kubernetes networking plugin based on Open vSwitch
Stars: ✭ 71 (+144.83%)
Mutual labels:  cni
ctnr
rootless runc-based container engine - deprecated in favour of podman
Stars: ✭ 30 (+3.45%)
Mutual labels:  cni
hybridnet
A CNI plugin, provides networking environment where overlay and underlay containers can run on the same node and have cluster-wide bidirectional network connectivity.
Stars: ✭ 188 (+548.28%)
Mutual labels:  cni
Bond Cni
Bond-cni is for fail-over and high availability of networking in cloudnative orchestration
Stars: ✭ 36 (+24.14%)
Mutual labels:  cni
Go Cni
A generic CNI library to provide APIs for CNI plugin interactions
Stars: ✭ 82 (+182.76%)
Mutual labels:  cni
Cni Genie
CNI-Genie for choosing pod network of your choice during deployment time. Supported pod networks - Calico, Flannel, Romana, Weave
Stars: ✭ 408 (+1306.9%)
Mutual labels:  cni
Sdn Handbook
SDN网络指南(SDN Handbook)
Stars: ✭ 856 (+2851.72%)
Mutual labels:  cni
Coil
CNI plugin for Kubernetes designed for scalability and extensibility
Stars: ✭ 81 (+179.31%)
Mutual labels:  cni
Terway
CNI plugin for Alibaba Cloud VPC/ENI
Stars: ✭ 312 (+975.86%)
Mutual labels:  cni
Kubernetes Networking Links
Kubernetes Networking recommended reading list
Stars: ✭ 175 (+503.45%)
Mutual labels:  cni
bridget
Simple bridge network for kubernetes
Stars: ✭ 37 (+27.59%)
Mutual labels:  cni
Multus Cni
Stars: ✭ 1,025 (+3434.48%)
Mutual labels:  cni
linen-cni
A CNI plugin designed for overlay networks with Open vSwitch
Stars: ✭ 48 (+65.52%)
Mutual labels:  cni
ovs-cni
Open vSwitch CNI plugin
Stars: ✭ 176 (+506.9%)
Mutual labels:  cni
Kubernetes The Ansible Way
Bootstrap Kubernetes the Ansible way on Everything (here: Vagrant). Inspired by Kelsey Hightower´s kubernetes-the-hard-way, but refactored to Infrastructure-as-Code.
Stars: ✭ 82 (+182.76%)
Mutual labels:  cni

CNI Cleaner API

CircleCI Go Report Card

Func

  • Remove unecessary cni file on kubernetes nodes (Running Pod/Orphaned Pod)
  • Exports CNI file number in Prometheus endpoint
  • Use Opencensus for tracing and metrics support

Prerequisite

This application must run inside kubernetes cluster.

It's recommended to run it must on Daemonset in order to access to all nodes where the cni files are located.

Deployment

Deployment on Kubernetes cluster:

kubectl apply -f k8s/deployment.yml

We will deploy:

  • RBAC Compatibility
  • Cronjob to launch cleanup each Monday
  • Service
  • Daemonset

Usage

CNI File Cleanner and Monitoring

Usage:
  api-cni-cleanup [command]

Available Commands:
  clean       Launch CNI Cleanner
  help        Help about any command
  job         Job Cleanner
  server      Launch CNI Cleanner Server

Flags:
      --api string         External or Internal K8S cluster (default "internal")
      --cnifiles string    Set CNI Folder (default "/var/lib/cni")
      --config string      config file (default is $HOME/.api-cni-cleanup.yaml)
      --debug              Set log level to Debug
  -h, --help               help for api-cni-cleanup
      --jaegerurl string   Set jaegger collector endpoint

Use "api-cni-cleanup [command] --help" for more information about a command.

Run Server Mode

When you launch application in server mode you will have prometheus metrics:

api-cni-cleanup server --api APITYPE --cnifiles YOURCNIFOLDER

Prometheus metrics are available on:

Stats are:

# HELP apicnicleanup_number_count number of files
# TYPE apicnicleanup_number_count gauge
apicnicleanup_number_count XX
# HELP apicnicleanup_size_bytes Size of the folder
# TYPE apicnicleanup_size_bytes gauge
apicnicleanup_size_bytes XX

Api entrypoint to launch the cleaning is:

Run Job Mode

In order to schedule the cleaning with a cronjob you can launch application in job mode:

Contact API CNI Cleanner:

api-cni-cleanup job --urlserver http://127.0.0.1:9010/cleanup,http://192.168.0.2:9010/cleanup

For automatic discovery, actually based on daemonset name and port:

api-cni-cleanup job --autodiscover

Just specify all you urlserver that's represent all you api-cni-cleanup servers

(OPTIONAL) Run Batch Mode

This application could be launch on demand. But you need to know where your pod is deployed in order to clean cni file on a targeted node.

Batch Mode cleaning:

api-cni-cleanup clean --api APITYPE --cnifiles YOURCNIFOLDER

TIPS

Vendoring constraint

TODO

  • Create New Metric on Prometheus = Count files + Folder Size
  • Diff IP files and API PodIP
  • Remove files unused
  • Api to launch cleanup
  • k8s deployment: DaemonSet + svc + Cronjob
  • Redefine api entrypoint with naming convention
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].