1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/samples
2019-11-11 17:55:54 -08:00
..
best_practices update policies and test cases 2019-11-11 17:55:54 -08:00
more update policies and test cases 2019-11-11 17:55:54 -08:00
AddDefaultNetworkPolicy.md update LimitNodePort 2019-11-10 21:34:22 -08:00
AddNamespaceResourceQuota.md update add_ns_quota 2019-11-10 20:58:57 -08:00
AddSafeToEvict.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
CheckUserGroup.md reorganize samples 2019-10-23 14:45:27 -07:00
DisallowBindMounts.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowDefaultNamespace.md update disallow_default_namespace and disallow_host_network_port and disallow_host_pid_ipc 2019-11-10 15:50:18 -08:00
DisallowDockerSockMount.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowHelmTiller.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowHostNetworkPort.md update disallow_docker_sock_mount and disallow_host_network_port 2019-11-10 12:53:48 -08:00
DisallowHostPIDIPC.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowLatestTag.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowNewCapabilities.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowPrivilegedContainers.md update disallow_priviledged 2019-11-08 20:04:42 -08:00
DisallowRootUser.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
DisallowSysctls.md add disallow_sysctl and move policies 2019-11-11 17:17:09 -08:00
README.md update policies and test cases 2019-11-11 17:55:54 -08:00
RequirePodProbes.md update require_probes 2019-11-10 21:18:17 -08:00
RequirePodRequestsLimits.md update require_pod_requests_limits 2019-11-10 21:06:49 -08:00
RequireReadOnlyRootFS.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
RestrictAutomountSAToken.md update restrict_automount_sa_token 2019-11-10 21:57:20 -08:00
RestrictImageRegistries.md update restrict_image_registries 2019-11-10 18:13:01 -08:00
RestrictIngressClasses.md update policies and test cases 2019-11-11 17:55:54 -08:00
RestrictNodePort.md update other policies 2019-11-11 14:09:07 -08:00

Sample Policies

Sample policies are designed to be applied to your Kubernetes clusters with minimal changes. 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/

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 resource quotas
  17. Add safe-to-evict for pods with emptyDir and hostPath volumes

Additional Policies

The 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