gatekeeper-library
kubernetes-network-policy-recipes
gatekeeper-library | kubernetes-network-policy-recipes | |
---|---|---|
8 | 13 | |
613 | 5,534 | |
1.6% | - | |
8.8 | 4.6 | |
1 day ago | 3 months ago | |
Open Policy Agent | ||
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
gatekeeper-library
-
Multi-tenancy in Kubernetes
Here is a library or rules for the Open Policy Agent.
- open-policy-agent/gatekeeper-library: The OPA Gatekeeper policy library.
-
Security scanning of k8s manifest files vs running cluster
https://github.com/open-policy-agent/gatekeeper-library is the library of OPA Gatekeeper policies.
- OPA Rego is ridiculously confusing - best way to learn it?
-
Container security best practices: Comprehensive guide
Many more examples are available in the OPA Gatekeeper library project!
-
Expose Open Policy Agent/Gatekeeper Constraint Violations for Kubernetes Applications with Prometheus and Grafana
by default and exposes metrics on path ```/metrics``` . It can run locally on your development box as long as you have a valid Kubernetes configuration in your home folder (i.e. if you can run kubectl and have the right permissions). When running on the cluster a ```incluster``` parameter is passed in so that it knows where to look up for the cluster credentials. Exporter program connects to Kubernetes API every 10 seconds to scrape data from Kubernetes API. We've used [this](https://medium.com/teamzerolabs/15-steps-to-write-an-application-prometheus-exporter-in-go-9746b4520e26) blog post as the base for the code. ## Demo Let's go ahead and prepare our components so that we have a Grafana dashboard to show us which constraints have been violated and how the number of violations evolve over time. ### 0) Required tools - [Git](https://git-scm.com/downloads): A git cli is required to checkout the repo and - [Kubectl](https://kubernetes.io/docs/tasks/tools/) and a working K8S cluster - [Ytt](https://carvel.dev/ytt/): This is a very powerful yaml templating tool, in our setup it's used for dynamically overlaying a key/value pair in all constraints. It's similar to Kustomize, it's more flexibel than Kustomize and heavily used in some [Tanzu](https://tanzu.vmware.com/tanzu) products. - [Kustomize](https://kustomize.io/): Gatekeeper-library relies on Kustomize, so we need it too. - [Helm](https://helm.sh/): We will install Prometheus and Grafana using helm - Optional: [Docker](https://www.docker.com/products/docker-desktop): Docker is only optional as we already publish the required image on dockerhub. ### 1) Git submodule update Run ```git submodule update --init``` to download gatekeeper-library dependency. This command will download the [gatekeeper-library](https://github.com/open-policy-agent/gatekeeper-library) dependency into folder ```gatekeeper-library/library``` . ### 2) Install OPA/Gatekeeper If your K8S cluster does not come with Gatekeeper preinstalled, you can use install it as explained [here](https://open-policy-agent.github.io/gatekeeper/website/docs/install/). If you are familiar with helm, the easiest way to install is as follows: ```bash helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts helm install gatekeeper/gatekeeper --generate-name
-
Who is doing image scanning on an admission controller? (Open source)
Gatekeeper library has example policies for restricting image repositories: https://github.com/open-policy-agent/gatekeeper-library/tree/master/library/general
-
Mental models for understanding Kubernetes Pod Security Policy PSP
You should check out the Gatekeeper project. There's plenty of templates available for use without having to write a single line of rego for most use cases (e.g https://github.com/open-policy-agent/gatekeeper-library)
kubernetes-network-policy-recipes
-
Kubernetes Security
Further reading: Controlling Access to Kubernetes API What is TLS Configure Service Accounts Dynamic Admission Control Network Policy Recipes
-
stopping namespaces to talk with each other
See: https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/04-deny-traffic-from-other-namespaces.md for an example of what you are looking to do.
-
Multi-tenancy in Kubernetes
This is not great for multi-tenancy, but you can correct this with NetworkPolicies.
- Please check thoroughly anything you copy and paste - ahmetb/kubernetes-network-policy-recipes: Example recipes for Kubernetes Network Policies that you can just copy paste
-
11 Resources that will make you a Kubernetes wizard in no time
🔗 https://github.com/ahmetb/kubernetes-network-policy-recipes
-
Data and System Visualization Tools That Will Boost Your Productivity
I'd recommend using this collection of network policy recipes to test out these 2 tools and see how they can be helpful to your workflow.
-
How to block access to pods from host? NetworkPolicy not working
Here's an example policy I've tried. https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/03-deny-all-non-whitelisted-traffic-in-the-namespace.md
-
Cleared my CKA exam with a score of 92%. Here are a few tips
The Network Policies recipes here: https://github.com/ahmetb/kubernetes-network-policy-recipes -- Do not under any circumstances overlook this goldmine of network policy examples. Super important.
-
How to learn and practice more in Kubernetes Network Policy for CKx exams and EKS ?
Good to learn more in Kubernetes network policy for CKx exams and EKS. Below are resources: 1/ read official doc and try to understand them well - https://kubernetes.io/docs/concepts/services-networking/network-policies/ 2/ bookmark samples for exams and EKS setups - https://kubernetes.io/docs/concepts/services-networking/network-policies/#networkpolicy-resource 3/ do more practices at https://github.com/ahmetb/kubernetes-network-policy-recipes 4/ visualize (image below) and try more at https://editor.cilium.io/ - it allows you to save the final netpol in k8s netpol OR Cilium netpol (EKS-A is using Cilium !)
- CKAD Exam Lab
What are some alternatives?
OPA (Open Policy Agent) - Open Policy Agent (OPA) is an open source, general-purpose policy engine.
ckad-questions - A set of exercises and solutions to prepare for the Certified Kubernetes Application Developer exam by Cloud Native Computing Foundation.
opa-scorecard
CKAD-exercises - A set of exercises to prepare for Certified Kubernetes Application Developer exam by Cloud Native Computing Foundation
helm-charts - Prometheus community Helm charts
cka-learning
conftest - Write tests against structured configuration data using the Open Policy Agent Rego query language
jsonvisio.com - 🔮 Seamlessly visualize your JSON data instantly into graphs; paste, import or fetch! [Moved to: https://github.com/AykutSarac/jsoncrack.com]
tfsec - Security scanner for your Terraform code
vagrant-kubernetes - Playground for setting up small Kubernetes cluster on some vagrant boxes and practice with various examples to get familiar with K8s.
opa-image-scanner - Kubernetes Admission Controller for Image Scanning using OPA
CKAD_labs - Includes labs I have done as part of preparation for CKAD exam