K8s-delete-protection - Kubernetes admission controller to avoid deleteing master nodes

k8s-delete-protection Admission Controller

If you want to make your Kubernetes cluster more robust and avoid to delete crucial resources, you may want to deploy this Admission Controller.

It is called "k8s-delete-protection" and can be easily configured to prohibit deletion of resources.

Configuration rules may be "must" rules or "must-not" rules.

For example, if you call the Controller with the following "must" and "must-not" rules :

# must rules
- namespace: default
  kinds:
    - Pod
    - Deployment
  label: allowed-for-deletion
- namespace: "*"
  kinds:
    - Node
  label: allowed-for-deletion
# must-not rules
- namespace: "*"
  kinds:
    - "*"
  label: protected-against-deletion

Now, you cannot delete any node unless you label it like this :

$ kubectl label <node> allowed-for-deletion=true

The same rule applies to any Pod or Deployment belonging to the default namespace.

Furthermore, you cannot delete any resource from any namespace if it is labeled with protected-against-deletion. You must unlabel it first :

$ kubectl label <resource> protected-against-deletion-

Command line parameters

$ ./main [--cert certificate_filename (default: ./server.pem)]
         [--key private_key_filename (default: ./server-key.pem)]
         [--port listening_port (default: 8443)]
         [--must-rules filename (default: ./must.rules)]
         [--must-not-rules filename (default: ./must-not.rules)]
Similar Resources

Admission webhooks the easy way

admission-webhooks-the-easy-way Goals controller-runtime simple and simpler type

Mar 13, 2022

A controller to create K8s Ingresses for Openshift routes.

route-to-ingress-operator A controller to create corresponding ingress.networking.k8s.io/v1 resources for route.openshift.io/v1 TODO int port string p

Jan 7, 2022

The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the operator-sdk or controller-runtime.

k8s-generic-webhook The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the opera

Nov 24, 2022

K8s controller implementing Multi-Cluster Services API based on AWS Cloud Map.

AWS Cloud Map MCS Controller for K8s Introduction AWS Cloud Map multi-cluster service discovery for Kubernetes (K8s) is a controller that implements e

Dec 17, 2022

Ejemplo de un k8s custom controller para un CRD nuevo

Clonado de kubernetes/sample-controller Para pruebas de un CRD nuevo This repository implements a simple controller for watching Foo resources as defi

Nov 3, 2021

K8S ConfigMap Merging Controller

ConfigMap Merging Controller (cmmc) cmmc is a k8s operator that allows for the merging of ConfigMap resources with data validation. Why? The impetus f

Oct 2, 2022

Controller-check - Run checks against K8s controllers to verify if they meets certain conventions

controller-check Run checks against K8s controllers to verify if they meets cert

Jan 4, 2022

network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

Network Node Manager network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of ku

Dec 18, 2022

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes. This project is inspired by agones. Introduction Genera

Nov 25, 2022
Kubernetes Admission Controller Demo: Validating Webhook for Namespace lifecycle events

Kubernetes Admission Controller Based on How to build a Kubernetes Webhook | Admission controllers Local Kuberbetes cluster # create kubernetes cluste

Feb 27, 2022
Write controller-runtime based k8s controllers that read/write to git, not k8s

Git Backed Controller The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writin

Dec 10, 2021
Image clone controller is a kubernetes controller to safe guard against the risk of container images disappearing

Image clone controller image clone controller is a kubernetes controller to safe guard against the risk of container images disappearing from public r

Oct 10, 2021
A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore

bookstore-sample-controller A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore. A resource cre

Jan 20, 2022
Kubernetes webhook development (validating admission webhook) tutorial using kubewebhook

pod-exec-guard-kubewebhook-tutorial Introduction This is a tutorial that shows how to develop a Kubernetes admission webhook. To explain this, the tut

Aug 26, 2022
Rqlite-recover - k8 controller to create recover json for rqlite cluster nodes when needed.

Cluster Recover for RQLite running on a k8s cluster The goal is to be able to recover a rqlite cluster when the majority of nodes get re-schedule to d

Sep 8, 2022
K8s-ingress-health-bot - A K8s Ingress Health Bot is a lightweight application to check the health of the ingress endpoints for a given kubernetes namespace.

k8s-ingress-health-bot A K8s Ingress Health Bot is a lightweight application to check the health of qualified ingress endpoints for a given kubernetes

Jan 2, 2022
Manages nodes in hybrid k8s self-hosted cluster

node-manager Manages nodes in hybrid k8s self-hosted cluster Supported providers Contabo Hetzner Robot (dedicated) Supported commands Heal - reboots a

Dec 23, 2021
Reconciler - A library to avoid overstuffed Reconcile functions of Kubernetes operators

reconciler A library to avoid overstuffed Reconcile functions of Kubernetes oper

May 31, 2022
Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:
Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:

Kubei is a vulnerabilities scanning and CIS Docker benchmark tool that allows users to get an accurate and immediate risk assessment of their kubernet

Dec 30, 2022