Skip to content

Commit 3f91b24

Browse files
committed
Final slide and demos for 20231103
1 parent 223710d commit 3f91b24

6 files changed

+30
-14
lines changed

120_kubernetes/kyverno/slides.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,24 @@ Start with namespaced policies
5959

6060
Migrate to cluster-wide policies for well-tested settings
6161

62-
Continue with cluster-wide policies and exclusions
62+
Continue with cluster-wide policies and exclusions
63+
64+
---
65+
66+
## Using Kyverno with GitOps
67+
68+
Considerations in the official documentation [](https://kyverno.io/docs/writing-policies/mutate/#gitops-considerations)
69+
70+
### flux
71+
72+
Flux performs a server-side dry-run to determine state
73+
74+
Kyverno operates during dry-run as well
75+
76+
Flux will natively accomodate for mutating admission controllers
77+
78+
### ArgoCD
79+
80+
ArgoCD does not support server-side dry-run yet (see [argoproj/argo-cd#11574](https://github.com/argoproj/argo-cd/issues/11574))
81+
82+
Applications must use `ignoreDifferences` to ignore mutations [](https://kyverno.io/docs/writing-policies/mutate/#argocd)

120_kubernetes/kyverno/mutation_automountServiceAccountToken.demo renamed to 120_kubernetes/kyverno/validation_automountServiceAccountToken.demo

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Disable automount of service account token
1+
# Prevent automount of service account token
22

33
# Deploy policy
44
cat <<EOF | kubectl apply -f -
@@ -18,16 +18,14 @@ spec:
1818
- Pod
1919
preconditions:
2020
any:
21-
- key: "{{ request.object.spec.serviceAccount || 'default' }}"
21+
- key: "{{ request.object.spec.serviceAccountName || 'default' }}"
2222
operator: Equals
2323
value: "default"
24-
mutate:
25-
patchStrategicMerge:
24+
validate:
25+
message: "FOO"
26+
pattern:
2627
spec:
2728
automountServiceAccountToken: false
28-
serviceAccount: ""
29-
serviceAccountName: ""
30-
serviceAccountToken: ""
3129
EOF
3230

3331
# Deploy pod

120_kubernetes/kyverno/mutation_automountServiceAccountToken.md renamed to 120_kubernetes/kyverno/validation_automountServiceAccountToken.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Unwanted Kubernetes API access can leak to privilege escalation
1010

1111
Those pods should not mount service account
1212

13-
### Demo [<i class="fa fa-comment-code"></i>](https://github.com/nicholasdille/container-slides/blob/master/120_kubernetes/kyverno/mutation_automountServiceAccountToken.demo "mutation_automountServiceAccountToken.demo")
13+
### Demo [<i class="fa fa-comment-code"></i>](https://github.com/nicholasdille/container-slides/blob/master/120_kubernetes/kyverno/validation_automountServiceAccountToken.demo "validation_automountServiceAccountToken.demo")
1414

15-
Add `automountServiceAccountToken` to pods
15+
Deny pods without `automountServiceAccountToken` when `serviceAccountName` is not specified or equals `default`

120_kubernetes/rbac/service_account.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ automountServiceAccountToken: false
4848
#...
4949
```
5050

51-
Can be overridden by specifying `automountServiceAccountToken: false` in the pod spec
51+
Can be overridden by specifying `automountServiceAccountToken: true` in the pod spec
5252

5353
### DEMO [<i class="fa fa-comment-code"></i>](https://github.com/nicholasdille/container-slides/blob/master/120_kubernetes/rbac/service_account.demo "service_account.demo")
5454

2023-11-03_heise-Kubernetes-absichern.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
</textarea></section>
6868
<section data-markdown="120_kubernetes/kyverno/slides.md" data-separator="^---$" data-separator-vertical="^--$"></section>
6969
<section data-markdown="120_kubernetes/kyverno/mutation.md" data-separator="^---$" data-separator-vertical="^--$"></section>
70-
<section data-markdown="120_kubernetes/kyverno/mutation_automountServiceAccountToken.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7170
<section data-markdown="120_kubernetes/kyverno/mutation_imagepullsecrets.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7271
<section data-markdown="120_kubernetes/kyverno/validation_labels.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7372
<section data-markdown="120_kubernetes/kyverno/validation_latest.md" data-separator="^---$" data-separator-vertical="^--$"></section>
73+
<section data-markdown="120_kubernetes/kyverno/validation_automountServiceAccountToken.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7474
<section data-markdown="120_kubernetes/kyverno/validation_naked_pods.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7575
<section data-markdown="120_kubernetes/kyverno/validation_resources.md" data-separator="^---$" data-separator-vertical="^--$"></section>
7676

2023-11-03_heise-Kubernetes-absichern.md

-2
This file was deleted.

0 commit comments

Comments
 (0)