Created
September 11, 2022 05:37
-
-
Save Vladmel1234/f218c49380038ae97c41f7a38486b4ef to your computer and use it in GitHub Desktop.
K8s debug script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAMESPACE=my-namespace | |
cat <<EOF | kubectl apply -n $NAMESPACE -f - | |
apiVersion: networking.k8s.io/v1 | |
kind: NetworkPolicy | |
metadata: | |
name: debug | |
spec: | |
podSelector: | |
matchLabels: | |
app: debug | |
policyTypes: | |
- Egress | |
egress: | |
- {} | |
EOF | |
kubectl run -i --tty -n $NAMESPACE --rm debug -l app=debug --image=busybox --restart=Never -- sh | |
kubectl -n $NAMESPACE delete networkpolicy debug |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment