Skip to content

Commit

Permalink
Update current feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fjammes committed Dec 18, 2024
1 parent b023315 commit f9960df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion labs/2_authorization/2_RBAC_role.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ do
done
ink "Set the namespace preference to 'foo'"
ink "so that all kubectl command are ran in ns 'foo' by default"
kubectl config set-context $(kubectl config current-context) --namespace=foo
kubectl config set-context --current --namespace=foo

ink "Create pod using image 'k8sschool/kubectl-proxy', and named 'shell' in ns 'foo'"
kubectl run shell --image=k8sschool/kubectl-proxy:$KUBECTL_PROXY_VERSION
Expand Down
4 changes: 4 additions & 0 deletions labs/3_policies/ex2-podsecurity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,18 @@ spec:
args:
- sleep
- "1000000"
# Required for restricted level
securityContext:
seccompProfile:
type: RuntimeDefault
###
runAsNonRoot: true
allowPrivilegeEscalation: false
# Required for restricted level
capabilities:
drop:
- ALL
###
add:
- NET_BIND_SERVICE
EOF
Expand Down
6 changes: 3 additions & 3 deletions labs/3_policies/ex4-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ kubectl exec -n "$NS" webserver -- netcat -q 2 -zv pgsql-postgresql 5432
set +x
ink "webserver to external pod"
set -x
if kubectl exec -n "$NS" webserver -- netcat -q 2 -nzv $EXTERNAL_IP 80
if kubectl exec -n "$NS" webserver -- netcat -w 3 -nzv $EXTERNAL_IP 80
then
set +x
ink -r "ERROR this connection should have failed"
Expand All @@ -174,7 +174,7 @@ fi
set +x
ink "external pod to database"
set -x
if kubectl exec -n "$NS" external -- netcat -w 2 -zv pgsql-postgresql 5432
if kubectl exec -n "$NS" external -- netcat -w 3 -zv pgsql-postgresql 5432
then
set +x
ink -r "ERROR this connection should have failed"
Expand All @@ -188,7 +188,7 @@ fi
set +x
ink "external pod to outside world"
set -x
if kubectl exec -n "$NS" external -- netcat -w 2 -zv www.k8s-school.fr 80
if kubectl exec -n "$NS" external -- netcat -w 3 -zv www.k8s-school.fr 80
then
set +x
ink -r "ERROR this connection should have failed"
Expand Down

0 comments on commit f9960df

Please sign in to comment.