1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/samples
shuting 3fa745bc3e
Bugfix policymutation (#1119)
* fix policy mutation - autogen does not have exclude

* update doc
2020-09-15 22:58:55 -07:00
..
best_practices Bugfix policymutation (#1119) 2020-09-15 22:58:55 -07:00
more update documentation 2019-12-10 09:51:15 -08:00
AddDefaultNetworkPolicy.md Generate policy does not work on namespace update (#1085) 2020-08-31 11:25:13 -07:00
AddNamespaceQuotas.md Generate policy does not work on namespace update (#1085) 2020-08-31 11:25:13 -07:00
AddSafeToEvict.md update documentation 2019-12-10 09:51:15 -08:00
CheckUserGroup.md update documentation 2019-12-10 09:51:15 -08:00
DisallowBindMounts.md Bugfix policymutation (#1119) 2020-09-15 22:58:55 -07:00
DisallowDefaultNamespace.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowDockerSockMount.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowHelmTiller.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowHostNetworkPort.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowHostPIDIPC.md update api in samples/ 2019-11-13 13:56:20 -08:00
DisallowLatestTag.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowNewCapabilities.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowPrivilegedContainers.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowRootUser.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
DisallowSysctls.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
README.md update documentation 2019-12-10 09:51:15 -08:00
RequirePodProbes.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RequirePodRequestsLimits.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RequireReadOnlyRootFS.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RestrictAutomountSAToken.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RestrictImageRegistries.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RestrictIngressClasses.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00
RestrictNodePort.md add validateFailureAction to all policies (#1068) 2020-08-19 14:04:58 -07:00

Sample Policies

Sample policies are designed to be applied to your Kubernetes clusters with minimal changes.

The policies are mostly validation rules in audit mode i.e. your existing workloads will not be impacted, but will be audited for policy complaince.

Best Practice Policies

These policies are highly recommended.

  1. Disallow root user
  2. Disallow privileged containers
  3. Disallow new capabilities
  4. Disallow kernel parameter changes
  5. Disallow use of bind mounts (hostPath volumes)
  6. Disallow docker socket bind mount
  7. Disallow hostNetwork and hostPort
  8. Disallow hostPID and hostIPC
  9. Disallow use of default namespace
  10. Disallow latest image tag
  11. Disallow Helm Tiller
  12. Require read-only root filesystem
  13. Require pod resource requests and limits
  14. Require pod livenessProbe and readinessProbe
  15. Add default network policy
  16. Add namespace quotas
  17. Add safe-to-evict for pods with emptyDir and hostPath volumes

Additional Policies

These policies provide additional best practices and are worthy of close consideration. These policies may require specific changes for your workloads and environments.

  1. Restrict image registries
  2. Restrict NodePort services
  3. Restrict auto-mount of service account credentials
  4. Restrict ingress classes
  5. Restrict User Group

Applying the sample policies

To apply these policies to your cluster, install Kyverno and import the policies as follows:

Install Kyverno

kubectl create -f https://github.com/nirmata/kyverno/raw/master/definitions/install.yaml

(installation docs)

Apply Kyverno Policies

To start applying policies to your cluster, first clone the repo:

git clone https://github.com/nirmata/kyverno.git
cd kyverno

Import best_practices from here:

kubectl create -f samples/best_practices

Import addition policies from here:

kubectl create -f samples/more/