Skip to content

Commit 46dfc74

Browse files
added pod and policy.yml
0 parents  commit 46dfc74

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

clusterPolicy.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: kyverno.io/v1
2+
kind: ClusterPolicy
3+
metadata:
4+
annotations:
5+
meta.helm.sh/release-name: kyverno-rules
6+
meta.helm.sh/release-namespace: kyverno
7+
pod-policies.kyverno.io/autogen-controllers: Deployment,StatefulSet
8+
policies.kyverno.io/category: Sample
9+
policies.kyverno.io/description: Using the Cosign project, OCI images may be signed
10+
to ensure supply chain security is maintained. Those signatures can be verified
11+
before pulling into a cluster. This policy checks the signature of an image
12+
repo called ghcr.io/kyverno/test-verify-image to ensure it has been signed by
13+
verifying its signature against the provided public key. This policy serves
14+
as an illustration for how to configure a similar rule and will require replacing
15+
with your image(s) and keys.
16+
policies.kyverno.io/minversion: 1.4.2
17+
policies.kyverno.io/severity: medium
18+
policies.kyverno.io/subject: Deployment, StatfulSet
19+
policies.kyverno.io/title: Verify Image
20+
name: verify-image
21+
spec:
22+
background: false
23+
failurePolicy: Fail
24+
rules:
25+
- exclude:
26+
any:
27+
- resources:
28+
namespaces:
29+
- kube-system
30+
- kube-node-lease
31+
- kube-public
32+
resources: {}
33+
generate:
34+
clone: {}
35+
match:
36+
any:
37+
- resources:
38+
kinds:
39+
- Deployment
40+
- StatefulSet
41+
resources: {}
42+
mutate: {}
43+
name: verify-image
44+
validate: {}
45+
verifyImages:
46+
- image: registry.domain.com*
47+
key: |-
48+
-----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0+VemMIOj5qCy9QeN9sry+a8lObl
49+
FPi9x3e5bZHSRoqCRw2wVqNfNSzJUqkgRe+6XB21N1LyvXkWcarEjppvvA==
50+
-----END PUBLIC KEY-----
51+
mutateDigest: false
52+
required: true
53+
verifyDigest: false
54+
validationFailureAction: enforce

pod.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-deployment
5+
labels:
6+
app: nginx
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: nginx
12+
template:
13+
metadata:
14+
labels:
15+
app: nginx
16+
spec:
17+
imagePullSecrets:
18+
- name: regcred
19+
containers:
20+
- name: nginx
21+
image: registry.domain.com/images/nginx:1.21.4-alpine
22+
ports:
23+
- containerPort: 80

0 commit comments

Comments
 (0)