-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add doc on how to use Istio Authorization with Knative and Istio mesh mode #2583
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a464b67
Add doc on how to use Istio Authorization with Knative
nak3 d12e364
Fix nit
nak3 9d72b92
Fix nit 2
nak3 9e1488c
Fix nit 3
nak3 cad71d6
Fix review comments
nak3 8d93bdb
Replace health with healthz
nak3 2b89f5d
Add comment for mTLS requirment
nak3 453400a
Fix review comment
nak3 581b45c
Fix review comments
nak3 e725e97
Remove allowing list by namespace
nak3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: "Enabling requests to Knative services when additional authorization policies are enabled" | ||
| weight: 25 | ||
| type: "docs" | ||
| --- | ||
|
|
||
| Knative Serving system pods, such as the activator and autoscaler components, require access to your deployed Knative services. | ||
nak3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| If you have configured additional security features, such as Istio's authorization policy, you must enable access to your Knative service for these system pods. | ||
|
|
||
| ## Before you begin | ||
|
|
||
| You must meet the following prerequisites to use Istio AuthorizationPolicy: | ||
|
|
||
| - [Istio must be used for your Knative Ingress](https://knative.dev/docs/install/any-kubernetes-cluster/#installing-the-serving-component). | ||
| - [Istio sidecar injection must be enabled](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/). | ||
|
|
||
| ## Enabling Istio AuthorizationPolicy | ||
|
|
||
| For example, the following authorization policy denies all requests to workloads in namespace `serving-tests`. | ||
|
|
||
| ``` | ||
| $ cat <<EOF | kubectl apply -f - | ||
| apiVersion: security.istio.io/v1beta1 | ||
| kind: AuthorizationPolicy | ||
| metadata: | ||
| name: deny-all | ||
| namespace: serving-tests | ||
| spec: | ||
| {} | ||
| EOF | ||
| ``` | ||
|
|
||
| In addition to allowing your application path, you'll need to configure Istio AuthorizationPolicy | ||
| to allow health checking and metrics collection to your applications from system pods. | ||
| You can allow access from system pods [by paths](#allow-access-from-system-pods-by-paths). | ||
|
|
||
| ## Allowing access from system pods by paths | ||
|
|
||
| Knative system pods access your application using the following paths: | ||
|
|
||
| - `/metrics` | ||
| - `/healthz` | ||
nak3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
nak3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The `/metrics` path allows the autoscaler pod to collect metrics. | ||
| The `/healthz` path allows system pods to probe the service. | ||
|
|
||
| You can add the `/metrics` and `/healthz` paths to the AuthorizationPolicy as shown in the example: | ||
|
|
||
| ``` | ||
| $ cat <<EOF | kubectl apply -f - | ||
| apiVersion: security.istio.io/v1beta1 | ||
| kind: AuthorizationPolicy | ||
| metadata: | ||
| name: allowlist-by-paths | ||
| namespace: serving-tests | ||
| spec: | ||
| action: ALLOW | ||
| rules: | ||
| - to: | ||
| - operation: | ||
| paths: | ||
| - /metrics # The path to collect metrics by system pod. | ||
| - /healthz # The path to probe by system pod. | ||
| EOF | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a doc for specifically the case when additional authorization policies are enabled or is it a general doc for using Istio authorization with Knative and Istio mesh mode (per the PR title)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It is a general doc for using Istio authorization with Knative and Istio mesh mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe I'm lacking context but when I read the title it does immediately suggest this is specifically for Istio (do other networking layers have authorization policies?).