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

Project network isolation can be enabled if RKE network plugin supports network policies #31338

Closed
janeczku opened this issue Feb 16, 2021 · 2 comments
Assignees
Labels
area/rke internal kind/enhancement Issues that improve or augment existing functionality priority/0 QA/M release-note Note this issue in the milestone's release notes
Milestone

Comments

@janeczku
Copy link
Contributor

What kind of request is this (question/bug/enhancement/feature request):
Enhancement

Steps to reproduce (least amount of steps as possible):
When configuring an RKE network provider that supports Kubernetes network policies, such as the Cisco ACI CNI plugin, Rancher should allow the cluster option to enable Project Network Isolation to be set (enable_network_policy: true).

Currently, when enabling the network isolation with such a compatible network provider the cluster provisioning fails with a validation error.

The validation is implemented here:

if plugin != "canal" {
return fmt.Errorf("plugin %s should have enableNetworkPolicy %v", plugin, !value)

Other details that may be helpful:

Rancher 2.5.5

@ryansann
Copy link
Contributor

ryansann commented Apr 13, 2021

Support Matrix

Rancher RKE Cluster Project Network Isolation (PNI) support per CNI

Network Provider Supports PNI
Calico Yes
Canal Yes
Weave Yes
ACI Yes
None/Custom Yes
Flannel No

Testing

Currently Rancher only allows for PNI to be enabled when selecting the Canal Network Provider when provisioning an RKE cluster. These changes allow for PNI to be enabled when using other CNIs.

Until this UI issue is complete, you can provision a cluster with PNI enabled by Selecting your CNI, editing the cluster as YAML, and flipping the top-level enable_network_policy field to true in the RKE config.

What follows is an outline of how I tested these changes.

Allowed Network Paths

With PNI enabled, and the below testing setup, these are the network paths that should be allowed
pni-allowed

Disallowed Network Paths

And these are the network paths that should not be allowed, since the traffic crosses project boundaries
pni-not-allowed

Steps

  1. Launch a cluster with a CNI that supports PNI (see support matrix above) and with PNI enabled
  2. Create a project: pni-testing and a namespace within it testing
  3. Launch the Rancher Hello World example as a workload in both the default and pni-testing projects, e.g.
    hello-world
  4. Create an ingress for each hello-world workload, e.g.
    hello-world-ingress
  5. Navigate to the generated xip.io url of the ingress and validate that the hello-world application loads, e.g.
    hello-world-app
    Do this for the hello-world deployed in the default project and the pni-testing project
  6. Deploy connection testing workloads
  • NOTE: this step uses this simple app
  • deploy conn-test workload to default project, which will be configured to talk to the hello-world workload in the same, default project. This is an allowed network path. e.g.
    conn-test-default
  • deploy conn-test-cross-proj workload to default project. This workload is configured to talk to the hello-world workload in the pni-testing project. This is a disallowed network path as it crosses project boundaries e.g.
    conn-test-cross-proj
  • repeat the above with the pni-testing project, i.e. deploy conn-test and conn-test-cross-proj there as well
  • validate that all allowed network paths are in fact working and all disallowed network paths are receiving i/o timeouts. To do this, check that the logs of each conn-test workload have entries like got succesful response: 200 OK and each conn-test-cross-proj workload has logs like: error calling http://hello-world.default.svc.cluster.local: Get "http://hello-world.default.svc.cluster.local": dial tcp 10.42.0.8:80: i/o timeout
  1. Repeat these steps for clusters provisioned with other CNIs that support PNI

@bmdepesa
Copy link
Member

rancher/rancher:v2.5-head 31f00c1

Tested enabling Project Network Isolation with the following CNIs:

  • Canal
  • Calico
  • Weave

Test Case

  • Create multiple projects and deploy 2 workloads in each using ranchertest/mytestcontainer image
  • From each project, ping a workload in the project and in another project
    • Workloads within the same project have a successful ping
    • Workloads in separate projects are not able to communicate
  • Ran automated test test_network_policy

2.6 Forwardport - #32220

UI Validations - #32106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rke internal kind/enhancement Issues that improve or augment existing functionality priority/0 QA/M release-note Note this issue in the milestone's release notes
Projects
None yet
Development

No branches or pull requests

9 participants