mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 10:55:05 +00:00
update LimitNodePort
This commit is contained in:
parent
5e8b6c4183
commit
5b2fd96131
4 changed files with 7 additions and 8 deletions
|
@ -6,7 +6,7 @@ A default `NetworkPolicy` should be configured for each namespace to default den
|
|||
|
||||
## Policy YAML
|
||||
|
||||
[require_default_network_policy.yaml](best_practices/require_default_network_policy.yaml)
|
||||
[add_network_policy.yaml](best_practices/add_network_policy.yaml)
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
|
|
|
@ -15,10 +15,10 @@ Although NodePort services can be useful, their use should be limited to service
|
|||
apiVersion: kyverno.io/v1alpha1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: disallow-node-port
|
||||
name: limit-node-port
|
||||
spec:
|
||||
rules:
|
||||
- name: disallow-node-port
|
||||
- name: validate-node-port
|
||||
match:
|
||||
resources:
|
||||
kinds:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
apiVersion: kyverno.io/v1alpha1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: disallow-node-port
|
||||
name: limit-nodeport
|
||||
annotations:
|
||||
policies.kyverno.io/category: Security
|
||||
policies.kyverno.io/description: A Kubernetes service of type NodePort uses a
|
||||
|
@ -10,7 +10,7 @@ metadata:
|
|||
must be limited to services with additional upstream security checks.
|
||||
spec:
|
||||
rules:
|
||||
- name: disallow-node-port
|
||||
- name: validate-nodeport
|
||||
match:
|
||||
resources:
|
||||
kinds:
|
||||
|
|
|
@ -4,14 +4,13 @@ input:
|
|||
expected:
|
||||
validation:
|
||||
policyresponse:
|
||||
policy: disallow-node-port
|
||||
policy: limit-nodeport
|
||||
resource:
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
namespace: ''
|
||||
name: "my-service"
|
||||
rules:
|
||||
- name: disallow-node-port
|
||||
- name: validate-nodeport
|
||||
type: Validation
|
||||
message: "Validation error: Disallow service of type NodePort\nValidation rule 'disallow-node-port' failed at path '/spec/type/'."
|
||||
success: false
|
Loading…
Add table
Reference in a new issue