Skip to content

Conversation

lei-tang
Copy link
Contributor

@lei-tang lei-tang commented Oct 15, 2019

A guide of using istioctl to manage webhooks in Istio.

This PR has URLs pointing to: istio/istio#17867 and #5152.
Thus the lint test will fail until these PRs are merged.

Please provide a description for what this PR is for: istio/istio#17061.

Design documents:
[1]https://docs.google.com/document/d/1VHyBre8943USOx_YEVtA18KfEoGTmLT1iBHESO5bzcA/edit#heading=h.qex63c29z2to
[2] https://docs.google.com/document/d/1v8BxI07u-mby5f5rCruwF7odSXgb9G8-C9W5hQtSIAg/edit#heading=h.xw1gqgyqs5b

And to help us figure out who should review this PR, please
put an X in all the areas that this PR affects.

[ ] Configuration Infrastructure
[ ] Docs
[ X] Installation
[ X] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ X] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

@lei-tang lei-tang requested a review from a team as a code owner October 15, 2019 19:49
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Oct 15, 2019
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 15, 2019
@lei-tang
Copy link
Contributor Author

/test lint_istio.io


## Before you begin

* Create a new Kubernetes cluster to run the example in this tutorial.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't think this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new cluster is not strictly needed, but to on the safe side -> avoid affecting an existing cluster.

install/kubernetes/helm/istio > istio-webhook-config.yaml
{{< /text >}}

1. From `istio-webhook-config.yaml`, search `'kind: MutatingWebhookConfiguration'` and save
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is for more then experimental we need to improve the UX here. If its is just experimental we should make that more clear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODOs to improve the UX here. The document has a warning at the top saying this is an experimental feature.

keywords: [security,webhook]
---

{{< warning >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the boilerplate for this warning please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,243 @@
---
title: Istio Webhook Management
description: Shows how to manage webhooks in Istio through istioctl.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include why a user would want to do this? Adding this doc, which is a lot of complicated and manual steps, makes it look like this is a required thing to user Istio properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the following explanation why a user would want to do this:
Istio has two webhooks (Galley and Sidecar Injector). In current Istio implementation,
Galley and Sidecar Injector manage their own webhook configurations, which from
security perspective is not recommended because a compromised webhook may conduct
privilege escalation attacks.

This task shows how to use istioctl, instead of Galley and Sidecar Injector, to
manage the webhook configurations of Galley and Sidecar Injector.

@lei-tang
Copy link
Contributor Author

@istio/wg-docs-maintainers-english All review comments have been addressed, can you approve the PR?

@geeknoid geeknoid requested a review from rcaballeromx October 23, 2019 03:03
@lei-tang lei-tang added this to the 1.4 milestone Oct 23, 2019
Copy link
Contributor

@rcaballeromx rcaballeromx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure readers can run all commands successfully.

@lei-tang
Copy link
Contributor Author

@rcaballeromx This feature is for Istio with version >= 1.4. Readers can run all commands successfully on Istio with version >= 1.4. The user guide will not be cherrypicked to older Istio versions (e.g., 1.3, 1.2, etc)

@lei-tang lei-tang requested a review from rcaballeromx October 23, 2019 22:09
@lei-tang
Copy link
Contributor Author

@rcaballeromx Per the discussion, the installation step is removed to decouple the installation from the user guide. Please take a look.

Copy link
Contributor

@rlenglet rlenglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Some relatively minor nits.

Copy link
Contributor

@rlenglet rlenglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!


{{< text plain >}}
Error from server: error when creating "invalid-gateway.yaml": admission webhook "pilot.validation.istio.io" denied the request: configuration is invalid: gateway must have at least one server
{{< /text >}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment here, i would expect this to fail in the default install also.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need more wording to explain why this is different and how to detect this is running in this new mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linsun How this is different does not belong in the task. We can work on a blog post evaluating both approaches but let's try not to overburden readers with information here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a step to verify that there are no existing webhook configurations for Galley and the sidecar injector before running the webhook enable command.

@@ -0,0 +1,231 @@
---
title: Istio Webhook Management [Experimental]
description: Shows how to manage webhooks in Istio through istioctl.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shows How to manage webhooks in Istio through istioctl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

Istio has two webhooks: Galley and the sidecar injector. By default,
these webhooks manage their own configurations. From a
security perspective, this default behavior is not recommended because a compromised webhook could then conduct
privilege escalation attacks.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

privileged escalation attacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be privilege escalation attacks.

security perspective, this default behavior is not recommended because a compromised webhook could then conduct
privilege escalation attacks.

This task shows how to use `istioctl`, instead of the webhooks, to
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task shows how to use istioctl, instead of the webhooks, to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

This task shows how to use `istioctl`, instead of the webhooks, to
manage their configurations.

## Before you begin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

## Before you begin

Getting started

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.


## Check webhook certificates

To display the DNS names in the webhook certificates of Galley and the sidecar injector, we get the secret
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To display the DNS names in the webhook certificates of Galley and the sidecar injector, we you need to get the secret

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

{{< /text >}}

1. To check that the sidecar injector webhook is working, verify that the webhook injects a
sidecar container into an example pod with the following commands:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To Check that the sidecar injector webhook is working by verifying that the webhook injects a
sidecar container into an example pod with the following commands:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current one is more accurate.

$ kubectl get pod -n test-injection
{{< /text >}}

The output from the `get pod` command should show the following output. The `2/2` value means that
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output from the get pod command should show the following output. The 2/2 value means that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

$ istioctl experimental post-install webhook disable --validation=false --injection-config=istio-sidecar-injector
{{< /text >}}

1. If you name Galleys's configuration `istio-galley`, disable the webhook with the following command:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you named Galleys's configuration istio-galley, disable the webhook with the following command:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.


After completing this tutorial, you may delete the testing cluster created
at the beginning of this tutorial. You may also run the following command to delete
the resources created.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After completing this tutorial, you may delete the testing cluster created
at the beginning of this tutorial.
You may also can run the following command to delete
the resources created at the beginning of this tutorial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

Copy link

@zjory zjory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcaballeromx Completed review

{{< /text >}}

<!-- TODO (lei-tang): improve the UX for obtain MutatingWebhookConfiguration -->
1. Open the `istio.yaml` configuration file, search `'kind: MutatingWebhookConfiguration'` and save
Copy link
Collaborator

@frankbu frankbu Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Open the `istio.yaml` configuration file, search `'kind: MutatingWebhookConfiguration'` and save
1. Open the `istio.yaml` configuration file, search for `kind: MutatingWebhookConfiguration` and save

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{{< /text >}}

<!-- TODO (lei-tang): improve the UX for obtain ValidatingWebhookConfiguration -->
1. Open the `istio.yaml` configuration file, search `'kind: ValidatingWebhookConfiguration'` and save
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Open the `istio.yaml` configuration file, search `'kind: ValidatingWebhookConfiguration'` and save
1. Open the `istio.yaml` configuration file, search for `kind: ValidatingWebhookConfiguration` and save

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

the webhook injected a sidecar into the example pod:

{{< text plain >}}
NAME READY STATUS RESTARTS AGE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NAME READY STATUS RESTARTS AGE
NAME READY STATUS RESTARTS AGE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

sidecar container into an example pod with the following commands:

{{< text bash >}}
$ kubectl create namespace test-injection; kubectl label namespaces test-injection istio-injection=enabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ kubectl create namespace test-injection; kubectl label namespaces test-injection istio-injection=enabled
$ kubectl create namespace test-injection
$ kubectl label namespaces test-injection istio-injection=enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

security perspective, this default behavior is not recommended because a compromised webhook could then conduct
privilege escalation attacks.

This task shows how to use `istioctl`, instead of webhooks, to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This task shows how to use `istioctl`, instead of webhooks, to
This task shows how to use the new [{{< istioctl >}} x post-install webhook](/docs/reference/commands/istioctl/#istioctl-experimental-post-install-webhook) command to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

privilege escalation attacks.

This task shows how to use `istioctl`, instead of webhooks, to
manage their configurations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
manage their configurations.
securely manage the configurations of the webhooks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly.

Copy link
Collaborator

@frankbu frankbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggested changes, but otherwise lgtm.

$ istioctl manifest generate > istio.yaml
{{< /text >}}

<!-- TODO (lei-tang): improve the UX for obtain MutatingWebhookConfiguration -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line. It is causing the numbered list not to render properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

istio-injection: enabled
{{< /text >}}

<!-- TODO (lei-tang): improve the UX for obtain ValidatingWebhookConfiguration -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

@istio istio deleted a comment from lei-tang Nov 8, 2019
@lei-tang
Copy link
Contributor Author

lei-tang commented Nov 8, 2019

/retest

@lei-tang
Copy link
Contributor Author

lei-tang commented Nov 8, 2019

/test lint_istio.io

@frankbu frankbu dismissed rcaballeromx’s stale review November 8, 2019 15:49

requested changes addressed

@istio-testing istio-testing merged commit b0cdd6f into istio:master Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.