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

ephemeral csi driver #21981

Closed
kfox1111 opened this issue Mar 9, 2020 · 8 comments
Closed

ephemeral csi driver #21981

kfox1111 opened this issue Mar 9, 2020 · 8 comments

Comments

@kfox1111
Copy link

kfox1111 commented Mar 9, 2020

Describe the feature request

As an alternate to the CNI driver which does not work well with initContainers, an ephemeral CSI driver could be written that:

  • creates a socket on which to listen for traffic available in the ephemeral volume
  • deploy the driver via daemonset
  • pods include the csi ephemeral Volume
  • the istio sidecar mounts the csi volume. When it is ready to receive traffic, it sends a message to the daemon listening on the unix socket
  • when the unix socket receives a message, the driver nsenter's the network namespace of the pod and iptable configures the network.

This, in addition to the sidecar pod feature should allow seamless transitioning of the network, while still separating privilege like the cni driver.

Describe alternatives you've considered

The existing solutions

Additional context

@howardjohn
Copy link
Member

@rlenglet

@rlenglet
Copy link
Contributor

rlenglet commented Mar 9, 2020

I don't see what problem this would solve. @kfox1111 can you clarify what you're trying to achieve here? Esp. can you clarify this statement:

CNI driver which does not work well with initContainers

@kfox1111
Copy link
Author

kfox1111 commented Mar 9, 2020

https://istio.io/docs/setup/additional-setup/cni/#compatibility-with-application-init-containers

  1. cni configures the pod network
  2. init containers run
  3. istio sidecar starts.

step 2 in the middle has connectivity issues. The workarounds for whitelisting particular ip's can sometimes mitigate this issue. Sometimes not.

The proposal would provide a mechanism for istio itself to trigger the pod network to be setup but only after its ready while maintaining privilege separation. This would eliminate the need of the white list so that initContainers always just work.

The workflow proposed looks like:

  1. init containers run
  2. istio sidecar starts. pokes privileged agent via csi driver to setup pod network to speak through istio
  3. containers start

@rlenglet
Copy link
Contributor

rlenglet commented Mar 9, 2020

The workflow proposed looks like:

  1. init containers run
  2. istio sidecar starts. pokes privileged agent via csi driver to setup pod network to speak through istio
  3. containers start

The Istio sidecar can't start until the init containers have terminated, i.e., your steps 2. and 3. would happen concurrently. Therefore, this would not guarantee that network redirection is setup when application container start. Therefore, connections to/from the application containers would bypass Istio until the sidecar proxy is configured. Therefore, those connections would bypass authn and authz, which is a security risk.

Any design that doesn't guarantee that connections to/from the application containers can't bypass Istio are not acceptable from a security viewpoint.

@kfox1111
Copy link
Author

kfox1111 commented Mar 9, 2020

Hmm... So one of the concerns is blocking incoming requests... That makes a lot of sense.

Is outgoing traffic also similarly constrained? Is it expected that all outgoing traffic will go out through istio?

@howardjohn
Copy link
Member

Is outgoing traffic also similarly constrained? Is it expected that all outgoing traffic will go out through istio?

We do not guarantee this. Since its running in the same pod, the application can do various things to bypass envoy on outbound traffic. If you want to enforce this you need to use egress gateway + network policies

@kfox1111
Copy link
Author

Ok. Then while there may still be a bit of value in maybe:

  • cni (or maybe csi driver) sets up ingress filters so no incoming traffic can happen
  • init containers run
  • sidecar istio comes up and does csi driver socket thing to setup the full network redirection through sidecar
  • rest of the containers come up

Not sure its worth the effort though.

@howardjohn
Copy link
Member

I think we will not be able to implement any solution that doesn't ensure traffic is captured. When I said outbound traffic, I meant we cannot ensure 100% that it is captured if a user tries to intentionally bypass it, but we cannot have a startup race condition. The sidecar KEP will solve these ordering problems, I suggest we focus efforts there: kubernetes/enhancements#1913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants