Kubevious Rules Library

June 13, 2024 ยท View on GitHub

Codefresh build status

Kubevious Rules Library

This repository represents a library of rules for Kubevious CLI project to validate errors (typos, conflicts, misconfigurations) and violations of compliance and security best practices in Kubernetes and related cloud-native projects.

Kubevious rules are expressed in a domain-specific language called Kubik.

Kubevious CLI Video

Library Contents

Total Rules: 36

Locations:

Rules:

๐Ÿ“‚ ARGO-ROLLOUT

๐Ÿ“œ Validate Argo Rollout to Analysis Template reference.

  • ๐Ÿท๏ธ argo ๐Ÿท๏ธ rollout ๐Ÿท๏ธ analysis ๐Ÿท๏ธ reference

๐Ÿ“‚ CERT-MANAGER

๐Ÿ“œ Validate CertManager Certificate to Issuer reference.

  • ๐Ÿท๏ธ cert-manager ๐Ÿท๏ธ certificate ๐Ÿท๏ธ issuer ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Ingress to CertManager Issuer reference.

  • ๐Ÿท๏ธ cert-manager ๐Ÿท๏ธ ingress ๐Ÿท๏ธ issuer ๐Ÿท๏ธ reference

๐Ÿ“‚ GCP-CONFIG-CONNECTOR/SQL

๐Ÿ“œ Validate GCP Config Connector SQL Database to Instance reference.

  • ๐Ÿท๏ธ gcp-config-connector ๐Ÿท๏ธ sql-database ๐Ÿท๏ธ sql-instance ๐Ÿท๏ธ reference

๐Ÿ“œ Validate GCP Config Connector SQL User to Instance reference.

  • ๐Ÿท๏ธ gcp-config-connector ๐Ÿท๏ธ sql-user ๐Ÿท๏ธ sql-instance ๐Ÿท๏ธ reference

๐Ÿ“œ Validate GCP Config Connector SQL User to Password Secret reference.

  • ๐Ÿท๏ธ gcp-config-connector ๐Ÿท๏ธ sql-user ๐Ÿท๏ธ secret ๐Ÿท๏ธ reference

๐Ÿ“‚ ISTIO

๐Ÿ“œ Validate Istio VirtualService to IstioGateway reference.

  • ๐Ÿท๏ธ istio ๐Ÿท๏ธ virtual-service ๐Ÿท๏ธ istio-gateway ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/CONTAINER

๐Ÿ“œ Validate ContainerSpec environment variable ConfigMap reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ environment-variable ๐Ÿท๏ธ config-map ๐Ÿท๏ธ reference

๐Ÿ“œ Validate ContainerSpec envFrom variables projection ConfigMap reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ environment-variable ๐Ÿท๏ธ config-map ๐Ÿท๏ธ reference

๐Ÿ“œ Validate ContainerSpec envFrom variables projection Secret reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ environment-variable ๐Ÿท๏ธ secret ๐Ÿท๏ธ reference

๐Ÿ“œ Validate ContainerSpec environment variable Secret reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ environment-variable ๐Ÿท๏ธ secret ๐Ÿท๏ธ reference

๐Ÿ“œ Validate ContainerSpec image to have non latest tag.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ image ๐Ÿท๏ธ latest

๐Ÿ“œ Validate ContainerSpec resource requests to be less or equal to the limits.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ resources ๐Ÿท๏ธ cpu ๐Ÿท๏ธ memory ๐Ÿท๏ธ request ๐Ÿท๏ธ limit

๐Ÿ“œ Validate ContainerSpec volume mount to PodSpec volume reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ container ๐Ÿท๏ธ volume ๐Ÿท๏ธ volume-mount ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/GATEWAY-API/GATEWAY

๐Ÿ“œ Validate Gateway to Certificate Secret reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ gateway-api ๐Ÿท๏ธ gateway ๐Ÿท๏ธ certificate ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Gateway to GatewayClass reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ gateway-api ๐Ÿท๏ธ gateway ๐Ÿท๏ธ gateway-class ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Gateway to have unique listeners.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ gateway-api ๐Ÿท๏ธ gateway ๐Ÿท๏ธ unique-listeners

๐Ÿ“‚ K8S/GATEWAY-API/HTTP-ROUTE

๐Ÿ“œ Validate HTTPRoute to Backend reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ gateway-api ๐Ÿท๏ธ http-route ๐Ÿท๏ธ backend ๐Ÿท๏ธ reference

๐Ÿ“œ Validate HTTPRoute to Gateway reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ gateway-api ๐Ÿท๏ธ http-route ๐Ÿท๏ธ gateway ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/HPA

๐Ÿ“œ Validate HorizontalPodAutoscaler to scale target reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ hpa ๐Ÿท๏ธ target ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/INGRESS

๐Ÿ“œ Validate Ingress (extension) to Service reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ ingress ๐Ÿท๏ธ ingress-extension ๐Ÿท๏ธ service ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Ingress to Service reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ ingress ๐Ÿท๏ธ service ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Ingress TLS and rule domain match.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ ingress ๐Ÿท๏ธ ingress-extension ๐Ÿท๏ธ tls ๐Ÿท๏ธ domain

๐Ÿ“œ Validate Ingresses to have unique routing rules.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ ingress ๐Ÿท๏ธ ingress-extension ๐Ÿท๏ธ unique-route

๐Ÿ“œ Validate IngressClasses to have at most only one default.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ ingress-class ๐Ÿท๏ธ unique-default

๐Ÿ“‚ K8S/NETWORK-POLICY

๐Ÿ“œ Validate NetworkPolicy to PodSpec reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ network-policy ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/POD-SPEC

๐Ÿ“œ Validate PodSpec to ServiceAccount reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ service-account ๐Ÿท๏ธ reference

๐Ÿ“œ Validate PodSpec volume mount ConfigMap reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ config-map ๐Ÿท๏ธ volume ๐Ÿท๏ธ reference

๐Ÿ“œ Validate PodSpec volume mount PersistentVolumeClaim reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ pvc ๐Ÿท๏ธ volume ๐Ÿท๏ธ reference

๐Ÿ“œ Validate PodSpec volume mount Secret reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ secret ๐Ÿท๏ธ volume ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/RBAC

๐Ÿ“œ Validate RoleBinding and ClusterRoleBinding to Role and ClusterRole reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ rbac ๐Ÿท๏ธ binding ๐Ÿท๏ธ role ๐Ÿท๏ธ reference

๐Ÿ“œ Validate RoleBinding and ClusterRoleBinding to ServiceAccount subject reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ rbac ๐Ÿท๏ธ binding ๐Ÿท๏ธ service-account ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/SERVICE

๐Ÿ“œ Validate Service to PodSpec label selector reference.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ service ๐Ÿท๏ธ pod-spec ๐Ÿท๏ธ reference

๐Ÿ“‚ K8S/WORKLOAD

๐Ÿ“œ Checks Deployments to have min/max replicas - with or without HPAs.

  • ๐Ÿท๏ธ k8s ๐Ÿท๏ธ deployment ๐Ÿท๏ธ replica-count

๐Ÿ“‚ KONG

๐Ÿ“œ Validate KongConsumer to Credential Secret reference.

  • ๐Ÿท๏ธ kong ๐Ÿท๏ธ consumer ๐Ÿท๏ธ credential ๐Ÿท๏ธ secret ๐Ÿท๏ธ reference

๐Ÿ“œ Validate Ingress and Service to Kong Plugin reference

  • ๐Ÿท๏ธ kong ๐Ÿท๏ธ ingress ๐Ÿท๏ธ service ๐Ÿท๏ธ plugin ๐Ÿท๏ธ reference

Contributing

To submit your rules to the library follow the steps:

  1. Find the right place for the rule under root directory.
  2. Index the library using:
$ kubevious index-library .
  1. Submit a pull request.