Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17-troubleshooting-network-policy #8

Open
matt-empson opened this issue Nov 5, 2023 · 0 comments
Open

17-troubleshooting-network-policy #8

matt-empson opened this issue Nov 5, 2023 · 0 comments

Comments

@matt-empson
Copy link

matt-empson commented Nov 5, 2023

To solve the network policy question in this lab, more policy rules were required for me to allow connectivity due to the default deny policy than in the solution file. The below policy got things working for me on minikube with the calico cni.

Thanks for putting the labs together. They were very helpful.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: web-app
spec:
  podSelector:
    matchLabels:
      app: web-app
  policyTypes:
    - Egress
    - Ingress
  ingress:
    - ports:
        - port: 3000
  egress:
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
      ports:
        - protocol: UDP
          port: 53
    - to:
        - podSelector:
            matchLabels:
              app: mysql-db
      ports:
        - protocol: TCP
          port: 3306
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: mysql
spec:
  podSelector:
    matchLabels:
      app: mysql-db
  policyTypes:
    - Ingress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app: web-app
      ports:
        - protocol: TCP
          port: 3306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant