faas-netes: Helm Chart is generating incorrect Istio Objects - Policy is deprecated from Istio v1.4/5
When using the OpenFaas helm chart with the istio.mtls=true value set the generated Istio objects are not compatible with newer Istio releases. The Policy object the helm chart is currently generating has been deprecated in favour of the PeerAuthentication object.
Expected Behaviour
The OpenFaaS helm chart should generate the correct Istio objects.
Current Behaviour
The OpenFaaS helm chart generats the incorrect Istio Policy objects.
Possible Solution
- Amend the chart to default to creating PeerAuthentication objects i.e.
kind: "PeerAuthentication"
metadata:
name: "default"
namespace: "openfaas"
spec:
mtls:
mode: STRICT
---
apiVersion: "security.istio.io/v1beta1"
kind: "PeerAuthentication"
metadata:
name: "default"
namespace: "openfaas-fn"
spec:
mtls:
mode: STRICT
- Amend the chart to take an additional Istio version value and then determine if it should create Istio Policy or PeerAuthentication objects
Steps to Reproduce (for bugs)
- helm upgrade openfaas --install openfaas/openfaas
–namespace openfaas
–set functionNamespace=openfaas-fn
–set generateBasicAuth=true
–set istio.mtls=true
Context
Cannot use Istio mTLS with the OpenFaaS deployment.
Your Environment
- FaaS-CLI version ( Full output from:
faas-cli version): CLI: commit: c12d57c39ac4cc6eef3c9bba2fb45113d882432f version: 0.12.14
Gateway uri: https://… version: 0.20.1 sha: 7b6cc60bd9865852cd11c98d4420752815052918 commit: Fix Invocation count wrong for multiple namespace
Provider name: faas-netes orchestration: kubernetes version: 0.12.8 sha: e88c54c3854614fe02809c6931d544f74d64c6f0
-
Docker version
docker version(e.g. Docker 17.0.05 ): -
What version and distriubtion of Kubernetes are you using?
kubectl versionKubernetes v1.18.8 -
Operating System and version (e.g. Linux, Windows, MacOS): Linux
-
Link to your project or a code example to reproduce issue:
-
What network driver are you using and what CIDR? i.e. Weave net / Flannel Calico
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 23 (14 by maintainers)
Commits related to this issue
- fix!: Rename NATS Service port from clients to TCP **What** - Rename the port on the NATS service object from `clients` to `tcp`, this is required to support Istio mTLS, I think because it fits the... — committed to LucasRoesler/faas-netes by LucasRoesler 3 years ago
- feat: Add prometheus path label to the scrap configuration **What** - Add configuration that tells prometheus to include the prometheus path annotation to the scrape labels. Per #714, this is req... — committed to LucasRoesler/faas-netes by LucasRoesler 3 years ago
- feat: Add istio PeerAuthentication when mtls is enabled **What** - Add Istio `PeerAuthentication` objects for the control plane namespace and the default function namespace when mTLS is enabled. ... — committed to LucasRoesler/faas-netes by LucasRoesler 3 years ago
- fix!: Rename NATS Service port from clients to TCP **What** - Rename the port on the NATS service object from `clients` to `tcp`, this is required to support Istio mTLS, I think because it fits the... — committed to openfaas/faas-netes by LucasRoesler 3 years ago
- feat: Add prometheus path label to the scrap configuration **What** - Add configuration that tells prometheus to include the prometheus path annotation to the scrape labels. Per #714, this is req... — committed to openfaas/faas-netes by LucasRoesler 3 years ago
- feat: Add istio PeerAuthentication when mtls is enabled **What** - Add Istio `PeerAuthentication` objects for the control plane namespace and the default function namespace when mTLS is enabled. ... — committed to openfaas/faas-netes by LucasRoesler 3 years ago
Ok, I had a change to retry today and … 💪 success!
Renaming the port on the nats Service seems to be the missing piece. Once I did that, everything just started working as expected.
So the next step is to make the changes to the chart right?
@howardjohn i am going to take a look at this tomorrow
Ok, looks like this is what is needed to get latest Istio working. End result is everything is injected with mTLS, prometheus works, etc.
I think the changes required (to nats service + prometheus config) should be compatible with non-istio as well.
Thanks, I will see if I can dig into this a bit.
Nope, should no longer be needed
Hi @howardjohn,
Thank you for reaching out 👍 - your help would be really appreciated.
Whilst we have a broad understanding of service-mesh and hands-on experience with Linkerd, the person who added and maintained the configurations for Istio cannot help with this any more and the alternative is removing Istio instructions.
I’ve reached out to Craig Box a few times to see if folks on the Istio team could help us bring the configs back up to date. OpenFaaS isn’t using any particularly advanced or esoteric features of Istio and doesn’t integrate to the API directly, but users have asked for a working configuration for mTLS.
OpenFaaS can be installed with arkade or helm (arkade is easier) https://docs.openfaas.com/deployment/kubernetes/ - just like Knative, each workload container i.e. “function” is deployed as a Deployment, and then a Pod.
The
direct_functions / directFunctionsflag has to be set to set to true to use a service mesh, so that the gateway uses the Service name of the function, if not, the endpoints are looked up and randomly accessed by endpoint IP (which I think would invalidate the use of mTLS, or just not work)We also have settings to switch to and from HTTP and exec probes. Does Istio still require exec probes? (HTTP tend to be more efficient)
A PR would be great, if you are able to give some broad instructions for deploying it with Istio, that would help us verify the behaviour too.
If you’re open to helping, let me know if you need anything here or on CNCF/K8s Slack.
Alex