All Projects → sighupio → fury-kubernetes-opa

sighupio / fury-kubernetes-opa

Licence: BSD-3-Clause license
Kubernetes Fury OPA. Policy enforcement for your Kubernetes Cluster

Programming Languages

shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to fury-kubernetes-opa

fury-distribution
Kubernetes Fury Distribution (Core Modules) - A battle-tested open-source Kubernetes distribution
Stars: ✭ 50 (+47.06%)
Mutual labels:  cncf, fury, sighup
CKA-Exercises
A set of curated exercises to help prepare you for the Certified Kubernetes Administrator Exam by the Cloud Native Computing Foundation
Stars: ✭ 51 (+50%)
Mutual labels:  cncf, k8s
kubernetes the easy way
Automating Kubernetes the hard way with Vagrant and scripts
Stars: ✭ 22 (-35.29%)
Mutual labels:  cncf, k8s
siddhi-operator
Operator allows you to run stream processing logic directly on a Kubernetes cluster
Stars: ✭ 16 (-52.94%)
Mutual labels:  cncf, k8s
Kubernetes Certified Administrator
Online resources that will help you prepare for taking the CNCF CKA 2020 "Kubernetes Certified Administrator" Certification exam. with time, This is not likely the comprehensive up to date list - please make a pull request if there something that should be added here.
Stars: ✭ 3,438 (+10011.76%)
Mutual labels:  cncf, k8s
Argo Workflows
Workflow engine for Kubernetes
Stars: ✭ 10,024 (+29382.35%)
Mutual labels:  cncf, k8s
Kubernetes-and-Cloud-Native-Associate-KCNA
Useful notes for the KCNA - Kubernetes and Cloud Native Associate
Stars: ✭ 162 (+376.47%)
Mutual labels:  cncf, k8s
Gatekeeper
Gatekeeper - Policy Controller for Kubernetes
Stars: ✭ 2,194 (+6352.94%)
Mutual labels:  cncf, opa
K8s Tew
Kubernetes - The Easier Way
Stars: ✭ 269 (+691.18%)
Mutual labels:  cncf, k8s
Kruise
Automate application management on Kubernetes (project under CNCF)
Stars: ✭ 2,819 (+8191.18%)
Mutual labels:  cncf, k8s
Kubesphere
The container platform tailored for Kubernetes multi-cloud, datacenter, and edge management ⎈ 🖥 ☁️
Stars: ✭ 8,315 (+24355.88%)
Mutual labels:  cncf, k8s
ccheck
A command line tool for validating Kubernetes configs with rego
Stars: ✭ 63 (+85.29%)
Mutual labels:  cncf, opa
docker-alpine-sshd
A lightweight OpenSSH Docker Image built atop Alpine Linux.
Stars: ✭ 108 (+217.65%)
Mutual labels:  k8s
github-task-manager
receive github hook, notify agent, receive task results, notify github
Stars: ✭ 13 (-61.76%)
Mutual labels:  k8s
kube-install
一鍵安裝部署高可用的多kubernetes集羣(二進位離線方式),支持定時安裝、添加與銷毀node、銷毀與修復master、一鍵卸載集羣等。One click offline installation of highly available multiple kubernetes cluster, supports schedule installation, addition of nodes, rebuild of kubernetes master, and uninstallation of clusters.
Stars: ✭ 336 (+888.24%)
Mutual labels:  k8s
meshery
Meshery, the cloud native manager
Stars: ✭ 1,587 (+4567.65%)
Mutual labels:  cncf
deployserver
Deploy your project automatically when git branch was updated.
Stars: ✭ 24 (-29.41%)
Mutual labels:  module
micro-service-practice
OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 25 (-26.47%)
Mutual labels:  k8s
pre-commit-opa
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development
Stars: ✭ 53 (+55.88%)
Mutual labels:  opa
icingaweb2-module-fileshipper
Provide CSV, JSON, XML and YAML files as an Import Source for the Icinga Director and optionally ship hand-crafted additional Icinga2 config files
Stars: ✭ 25 (-26.47%)
Mutual labels:  module

Kubernetes Fury OPA

Release License Slack

Kubernetes Fury OPA provides policy enforcement at runtime for the Kubernetes Fury Distribution (KFD) using OPA Gatekeeper.

If you are new to KFD please refer to the official documentation on how to get started with KFD.

Overview

The Kubernetes API server provides a mechanism to review every request that is made, being object creation, modification, or deletion. To use this mechanism the API server allows us to create a Validating Admission Webhook that, as the name says, will validate every request and let the API server know if the request is allowed or not based on some logic (policy).

Kubernetes Fury OPA module is based on OPA Gatekeeper, a popular open-source Kubernetes-native policy engine with OPA as its core that runs as a Validating Admission Webhook. It allows writing custom constraints (policies) in rego (a tailor-made language) as Kubernetes objects and enforcing them at runtime.

SIGHUP provides a set of base constraints that could be used both as a starting point to apply constraints to your current workloads or to give you an idea of how to implement new rules matching your requirements.

Packages

Fury Kubernetes OPA provides the following packages:

Package Version Description
Gatekeeper Core v3.9.2 Gatekeeper deployment, ready to enforce rules.
Gatekeeper Rules N.A. A set of custom rules to get started with policy enforcement.
Gatekeeper Monitoring N.A. Metrics, alerts and dashboard for monitoring Gatekeeper.
Gatekeeper Policy Manager v1.0.2 Gatekeeper Policy Manager, a simple to use web-ui for Gatekeeper.

Click on each package name to see its full documentation.

Compatibility

Kubernetes Version Compatibility Notes
1.21.x No known issues
1.22.x No known issues
1.23.x No known issues.
1.24.x No known issues.

Check the compatibility matrix for additional information on previous releases of the module.

Usage

Prerequisites

Tool Version Description
furyctl >=0.6.0 The recommended tool to download and manage KFD modules and their packages. To learn more about furyctl read the official documentation.
kustomize >=3.5.0 Packages are customized using kustomize. To learn how to create your customization layer with kustomize, please refer to the repository.
KFD Monitoring Module >v1.10.0 Expose metrics to Prometheus (optional).

You can comment out the service monitor in the kustomization.yaml file if you don't want to install the monitoring module.

Deployment

  1. List the packages you want to deploy and their version in a Furyfile.yml
bases:
  - name: opa/gatekeeper
    version: "v1.7.2"

See furyctl documentation for additional details about Furyfile.yml format.

  1. Execute furyctl vendor -H to download the packages

  2. Inspect the download packages under ./vendor/katalog/opa/gatekeeper.

  3. Define a kustomization.yaml that includes the ./vendor/katalog/opa/gatekeeper directory as a resource.

resources:
  - ./vendor/katalog/opa/gatekeeper
  1. Apply the necessary patches. You can find a list of common customization here.

  2. To deploy the packages to your cluster, execute:

kustomize build . | kubectl apply -f -

⚠️ Gatekeeper is deployed by default as a Fail open (also called Ignore mode) Admission Webhook. Should you decide to change it to Fail mode read carefully the project's documentation on the topic first.

⚠️ If you decide to deploy Gatekeeper to a different namespace than the default gatekeeper-system, you'll need to patch the file vwh.yml to point to the right namespace for the webhook service due to limitations in the kustomize tool.

Common Customizations

Exempting a namespace

Gatekeeper supports 3 levels of granularity to exempt a namespace from policy enforcement.

  1. Global exemption at Kubernetes API webhook level: the requests to the API server for the namespace won't be sent to Gatekeeper's webhook.
  2. Global exemption at Gatekeeper configuration level: requests to the API server for the namespace will be sent to Gatekeeper's webhook, but Gatekepeer will not enforce constraints for the namespace. It is the equivalent of exempting the namespace in all the constraints. Useful when you don't want any of the constraints enforced in a namespace.
  3. Exemption at constraint level: you can exempt namespaces in the definition of each constraint. Useful when you may want only a subset of all the constraints to be enforced in a namespace.

⚠️ Exempting critical namespaces like kube-system or logging won't guarantee that the cluster will function properly when Gatekeeper webhook is in Fail mode.

For more details on how to implement the exemption, please refer to the official Gatekeeper documentation site.

Disable constraints

Disable one of the default constraints by creating the following kustomize patch:

patchesJson6902:
    - target:
          group: constraints.gatekeeper.sh
          version: v1beta1
          kind: K8sUniqueIngressHost # replace with the kind of the constraint you want to disable
          name: unique-ingress-host # replace with the name of the constraint you want to disable
      path: patches/allow.yml

add this to the patches/allow.yml file:

- op: "replace"
  path: "/spec/enforcementaction"
  value: "allow"

Emergency brake

If for some reason OPA Gatekeeper is giving you issues and blocking normal operations in your cluster, you can disable it by removing the Validating Admission Webhook definition from your cluster:

kubectl delete ValidatingWebhookConfiguration gatekeeper-validating-webhook-configuration

Monitoring

Gatekeeper is configured by default in this module to expose some Prometheus metrics about its health, performance, and operative information.

You can monitor and review these metrics by checking out the provided Grafana dashboard. (This requires the KFD Monitoring Module to be installed).

Go to your cluster's Grafana and search for the "Gatekeeper" dashboard.

You can also use Gatekeeper Policy Manager to view the Constraints Templates, Constraints, and Violations in a simple-to-use UI.

Two alerts are also provided by default with Gatekeeper, the alerts are triggered when the number of errors seen by the Kubernetes API server trying to contact Gatekeeper's webhook is too high. Both for Fail open (Ignore) mode and Fail mode.

Notice that the alert for when the Gatekeeper webhook is in Ignore mode (the default) depends on an API server metric that has been added in Kubernetes version 1.24. Previous versions of Kubernetes won't trigger alerts when the webhook is failing and in Ignore mode.

Contributing

Before contributing, please read the Contributing Guidelines.

Reporting Issues

In case you experience any problems with the module, please open a new issue.

License

This module is open-source and it's released under the following LICENSE

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].