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

Verify Network Isolation is working as expected #1379

Open
devdattakulkarni opened this issue Dec 5, 2024 · 8 comments
Open

Verify Network Isolation is working as expected #1379

devdattakulkarni opened this issue Dec 5, 2024 · 8 comments

Comments

@devdattakulkarni
Copy link
Contributor

devdattakulkarni commented Dec 5, 2024

KubePlus creates a Network boundary using NetworkPolicy objects for each deployed application instance.
There are two NetworkPolicy objects created. One which restricts cross-namespace traffic.
Second which allows only traffic from outside world to reach the application namespace.
The implementation is here:
https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L1106

Above Network policies are taken from the Network Policy recipes given here:
https://github.com/ahmetb/kubernetes-network-policy-recipes

Specifically:

This issue is to verify that the above NetworkPolicies really work for KubePlus-managed application instances.

In order to test the Network Policies, here are steps:

  • On Minikube, first install a Network driver that is able to recognize NetworkPolicy objects (e.g.: cilium).
  • Create HelloWorldService CRD
  • Create two instances of HelloWorldService (hs1 and hs2).
  • kubectl exec into hs1 and try to ping/curl app endpoints in hs2. This traffic should be denied
  • kubectl exec into hs2 and try to ping/curl app endpoint in hs1. This should should be denied.
  • Perform additional tests given on the above links.

Create a PR with any changes that need to be included in the NetworkPolicy implementation

@devdattakulkarni
Copy link
Contributor Author

@SuyogShinde942 Can you take a look at this issue next?

@SuyogShinde942
Copy link
Contributor

sure

@SuyogShinde942
Copy link
Contributor

The cross network isolation is working as expected.

Screenshot 2024-12-18 at 11 37 25 AM Screenshot 2024-12-18 at 11 37 30 AM

@devdattakulkarni
Copy link
Contributor Author

@SuyogShinde942 Nice!!
What was the setup that you had to do? Which network driver did you install?

@devdattakulkarni
Copy link
Contributor Author

devdattakulkarni commented Dec 18, 2024

@SuyogShinde942 I am thinking that we should document the exact steps inside the examples folder.
We can add a file (advanced-usecases.md). Add a link to this file towards the end of "getting-started.md"

@SuyogShinde942
Copy link
Contributor

I followed the steps mentioned in the steps.txt for /examples/multitenancy/hello-world, To start the minikube with network driver i used command "minikube start --cni=cilium"

@devdattakulkarni
Copy link
Contributor Author

devdattakulkarni commented Dec 18, 2024

Got it. To test network isolation, you also had to follow the steps listed above, right? And then the exec into Pod and curl commands? We should document all of this so that when others want to test it, they will know exactly what steps to follow. @SuyogShinde942

@SuyogShinde942
Copy link
Contributor

sure, Should we create any other file for network isolation testing ?

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

2 participants