Installing Istio for Knative
If your cloud platform offers a managed Istio installation, we recommend installing Istio that way, unless you need to customize your installation.
You need:
- A Kubernetes cluster created.
istioctl
(v1.7 or later) installed.
Supported Istio versions
The current known-to-be-stable version of Istio tested in conjunction with Knative is v1.8.2. Versions in the 1.7 line are generally fine too. 1.8.0 and 1.8.1 have bugs that don’t work with Knative.
When you install Istio, there are a few options depending on your goals. For a basic Istio installation suitable for most Knative use cases, follow the Installing Istio without sidecar injection instructions. If you’re familiar with Istio and know what kind of installation you want, read through the options and choose the installation that suits your needs.
You can easily customize your Istio installation with istioctl
. The below sections cover a few useful Istio configurations and their benefits.
You can install Istio with or without a service mesh:
If you want to get up and running with Knative quickly, we recommend installing Istio without automatic sidecar injection. This install is also recommended for users who don’t need the Istio service mesh, or who want to enable the service mesh by manually injecting the Istio sidecars.
Installing Istio without sidecar injection
Enter the following command to install Istio:
Installing Istio with sidecar injection
Allows you to turn on , which secures service-to-service traffic within the cluster.
Allows you to use the Istio authorization policy, controlling the access to each Knative service based on Istio service roles.
To automatic sidecar injection, set autoInject: enabled
in addition to above operator configuration.
global:
proxy:
autoInject: enabled
Using Istio mTLS feature
Since there are some networking communications between knative-serving namespace and the namespace where your services running on, you need additional preparations for mTLS enabled environment.
- Enable sidecar container on
knative-serving
system namespace.
kubectl label namespace knative-serving istio-injection=enabled
- Set
PeerAuthentication
toPERMISSIVE
on knative-serving system namespace.
cat <<EOF | kubectl apply -f -
apiVersion: "security.istio.io/v1beta1"
kind: "PeerAuthentication"
metadata:
name: "default"
namespace: "knative-serving"
spec:
mode: PERMISSIVE
EOF
After you install the cluster local gateway, your service and deployment for the local gateway are both named cluster-local-gateway
.
If you create a custom service and deployment for local gateway with a name other than cluster-local-gateway
, you need to update gateway configmap config-istio
under the knative-serving
namespace.
- Edit the
config-istio
configmap:
- Replace the
local-gateway.knative-serving.cluster-local-gateway
field with the custom service. As an example, if you name both the service and deploymentcustom-local-gateway
under the namespaceistio-system
, it should be updated to:
custom-local-gateway.istio-system.svc.cluster.local
As an example, if both the custom service and deployment are labeled with custom: custom-local-gateway
, not the default istio: cluster-local-gateway
, you must update gateway instance cluster-local-gateway
in the knative-serving
namespace:
kubectl edit gateway cluster-local-gateway -n knative-serving
Replace the label selector with the label of your service:
For the service above, it should be updated to:
If there is a change in service ports (compared to that of cluster-local-gateway
), update the port info in the gateway accordingly.
kubectl get pods --namespace istio-system
Knative dispatches to different services based on their hostname, so it is recommended to have DNS properly configured.
To do this, begin by looking up the external IP address that Istio received:
$ kubectl get svc -nistio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cluster-local-gateway ClusterIP 10.0.2.216 <none> 15020/TCP,80/TCP,443/TCP 2m14s
istio-ingressgateway LoadBalancer 10.0.2.24 34.83.80.117 15020:32206/TCP,80:30742/TCP,443:30996/TCP 2m14s
istio-pilot ClusterIP 10.0.3.27 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 2m14s
This external IP can be used with your DNS provider with a wildcard A
record. However, for a basic non-production set up, this external IP address can be used with xip.io
in the config-domain
ConfigMap in knative-serving
.
You can edit this by using the following command:
Given the external IP above, change the content to:
Istio resources
For the official Istio installation guide, see the .
For the full list of available configs when installing Istio with
istioctl
, see the Istio Installation Options reference.
See the .
What’s next
- Try the for Knative serving.
Was this page helpful?
Sorry to hear that. Please tell us how we can improve.