Skip to content

Instantly share code, notes, and snippets.

@TheNotary
Created August 29, 2019 02:41
Show Gist options
  • Save TheNotary/011e9723b04231f84175fc8dd114ef57 to your computer and use it in GitHub Desktop.
Save TheNotary/011e9723b04231f84175fc8dd114ef57 to your computer and use it in GitHub Desktop.
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: "allow-nodeport-my-shell"
spec:
podSelector:
matchLabels:
run: "my-shell"
policyTypes:
ingress:
- ports:
- protocol: TCP
port: 8080
egress:
- ports:
- port: 443
protocol: TCP
- port: 80
protocol: TCP
[dev-laptop] $ kubectl run my-shell --rm -i --tty --image registry.example.com/some-org/docker-debianimage -- bash
[no-name] $ ping google.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment