Skip to content

Conversation

alexandrealvino
Copy link
Contributor

Please provide a description for what this PR is for.

This PR adds documentation for the SPIRE SDS integration #37947

It depends on #37948

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

alexandrealvino and others added 8 commits March 15, 2022 15:12
Co-authored-by: Maximiliano Churichi <mchurichi@gmail.com>

Co-authored-by: Max Lambrecht <max.lambrecht@hpe.com>

Co-authored-by: Juliano Fantozzi <juliano.fantozzi@gmail.com>

Co-authored-by: sanderson042 <steve.anderson@hpe.com>

* Apply PR feedbacks

* Apply PR feedbacks, adds commands and bash outputs
Co-authored-by: Maximiliano Churichi <mchurichi@gmail.com>

Co-authored-by: Max Lambrecht <max.lambrecht@hpe.com>

Co-authored-by: Juliano Fantozzi <juliano.fantozzi@gmail.com>

Co-authored-by: Steve Anderson <steve.anderson@hpe.com>
Co-authored-by: Maximiliano Churichi <mchurichi@gmail.com>
Adds Spire Integration Documentation
@alexandrealvino alexandrealvino requested a review from a team as a code owner March 15, 2022 20:47
@istio-policy-bot
Copy link

😊 Welcome! This is either your first contribution to the Istio documentation repo, or
it's been awhile since you've been here. A few things you should know:

  • You can learn about how we write and maintain documentation, about our style guidelines,
    and about all the available web site features by visiting Contributing to the Docs.

  • In the next few minutes, an automatic preview of your change will be
    built as a full copy of the istio.io website. You can find this preview by clicking on
    the Details link next to the deploy/netlify entry in the Status section of this
    page.

  • We care about quality, so we've put in place a number of checks to ensure our documentation
    is top notch. We do spell checking, we sanitize the markdown, we ensure all hyperlinks point
    to valid location, and more. If your PR doesn't pass one of these checks, you'll see a red X in the
    status section of the page. Click on the Details link to get a list of the problems with your PR.
    Fix those problems and push an update to your PR. This will automatically rerun the tests and
    hopefully this time everything will be perfect.

  • Once your changes are accepted and merged into the repository, they will initially show up
    on https://preliminary.istio.io. The changes will be published to https://istio.io
    the next time we do a major release (which typically happens every 3 months or so).

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@google-cla
Copy link

google-cla bot commented Mar 15, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test labels Mar 15, 2022
@istio-testing
Copy link
Contributor

Hi @alexandrealvino. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@craigbox
Copy link
Contributor

/ok-to-test

Excited to see this integration! Are you working with a maintainer to shepherd it through?

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Mar 15, 2022
@alexandrealvino
Copy link
Contributor Author

/ok-to-test

Excited to see this integration! Are you working with a maintainer to shepherd it through?

Yes, @howardjohn @linsun @lei-tang are aware of the integration

app: sleep
# Injects custom sidecar template
annotations:
inject.istio.io/templates: "sidecar,spire"
Copy link

@hobbytp hobbytp Mar 17, 2022

Choose a reason for hiding this comment

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

why spire enable or not is aware by every pod/deployment through the annotation? Is there a global flag for it ?

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 annotation applies the custom spire template created on the configuration of the Install Istio section:

      templates:
        spire: |
          spec:
            containers:
            - name: istio-proxy
              volumeMounts:
              - name: workload-socket
                mountPath: /run/secrets/workload-spiffe-uds
                readOnly: true
             volumes:
               - name: workload-socket
                 csi:
                   driver: "csi.spiffe.io"

The custom template feature facilitates the injection of the spiffe-csi-driver volume into workload pods.

But one can always do it manually by adding the volume to the workload spec:

      volumes:
      - name: tmp
        emptyDir: {}
      # CSI volume
      - name: workload-socket
        csi:
          driver: "csi.spiffe.io"

Copy link
Contributor

@ericvn ericvn left a comment

Choose a reason for hiding this comment

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

#11069 has changes for the two issues here as well as indention within the text blocks.

@ericvn ericvn mentioned this pull request Mar 18, 2022
10 tasks
---
title: SPIRE
description: Describes how to configure Istio to integrate with SPIRE to get cryptographic identities through Envoy's SDS API.
weight: 40
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine leaving this last in the list, but it seems we currently have the weights having the integrations in alphabetical order. Since they are all separated by one, it's hard to add one into the list. We could change them all to be operated by 5 and add this into the mix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added 1 to the zipkin page and updated SPIRE page to be 31, is it ok?

@alexandrealvino
Copy link
Contributor Author

/retest

This integration with SPIRE provides flexible attestation options not available with the default Istio identity management while harnessing Istio's powerful service management.
For example, SPIRE's plugin architecture enables diverse workload attestation options beyond the Kubernetes namespace and service account attestation offered by Istio.
SPIRE's node attestation extends attestation to the physical or virtual hardware on which workloads run.

Copy link
Member

Choose a reason for hiding this comment

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

Let us make sure we add a warning that Istio 1.14 is required, assuming this feature lands in 1.14.

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure I agree? This is the docs for Istio 1.14 - it should be assumed everything needs 1.14?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the Istall Istio section, the doc recommends the latest version of Istio. Should I recommend 1.14+ then?

Copy link
Member

Choose a reason for hiding this comment

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

Thinking more about it, i think it would be useful to note both data plane and control plane are required to be 1.14. (Is this correct?)

Copy link
Member

@linsun linsun Apr 4, 2022

Choose a reason for hiding this comment

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

Also would be useful to clarify if this only works with NEW istio 1.14 vs upgrading to Istio 1.14 @alexandrealvino

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @linsun, only the data plane and istioctl are required to be 1.14. I will clarify that on the docs.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds great, thanks @alexandrealvino !

@linsun
Copy link
Member

linsun commented Mar 25, 2022

Hi @alexandrealvino nice doc! Any plan to cover migration as well? migrating from existing CA (either istiod) or an external CA to SPIRE? Or is this only for new install?

@alexandrealvino
Copy link
Contributor Author

Hi @alexandrealvino nice doc! Any plan to cover migration as well? migrating from existing CA (either istiod) or an external CA to SPIRE? Or is this only for new install?

Hi @linsun, this is only for new installations. The code changes covers only the startup process of istio-agent, the are not recurrent checks for the detection of the SPIRE Agent instance.

@christian-posta
Copy link
Contributor

I wrote this on istio/istio#37948, but it probably should be in this issue instead: "I think this "quickstart" install of the spire server also includes the k8s-workload-registrar for auto-registration... we should add that to the doc somewhere and possibly indicate manual registration wouldn't be necessary here"

@alexandrealvino
Copy link
Contributor Author

I wrote this on istio/istio#37948, but it probably should be in this issue instead: "I think this "quickstart" install of the spire server also includes the k8s-workload-registrar for auto-registration... we should add that to the doc somewhere and possibly indicate manual registration wouldn't be necessary here"

Hi @christian-posta, I've pointed this out on this section from Option 1: Quick start "and the SPIRE Kubernetes Workload Registrar, a facilitator that performs automatic workload registration within Kubernetes. See Install Istio to configure Istio and integrate with the SPIFFE CSI Driver."

@christian-posta
Copy link
Contributor

Ah, i see it now. I missed it. Can you also add under "Option 1: Automatic registration using the SPIRE workload registrar" that we do indeed set it up in this guide?

@alexandrealvino
Copy link
Contributor Author

Ah, i see it now. I missed it. Can you also add under "Option 1: Automatic registration using the SPIRE workload registrar" that we do indeed set it up in this guide?

Sorry about the delay @christian-posta, missed the notification. Do you mean add a sentence explaining that it won't be necessary to add registrations manually on the "Option 1: Automatic registration using the SPIRE workload registrar" section?

@christian-posta
Copy link
Contributor

Yeah, basically that since it's already being used... that we don't have to follow that Option it's already assumed in the guide... otherwise it seems optional (which it is -- but it actually is done in this doc) and that people should continue on to do it manually... which they don't need to do

@alexandrealvino
Copy link
Contributor Author

Yeah, basically that since it's already being used... that we don't have to follow that Option it's already assumed in the guide... otherwise it seems optional (which it is -- but it actually is done in this doc) and that people should continue on to do it manually... which they don't need to do

Got it! I will add some comments clarifying that on "Option 2: Manual Registration" and "Option 1: Automatic registration using the SPIRE workload registrar" sections. Now I see the confusion, thanks for your suggestion @christian-posta

@ericvn
Copy link
Contributor

ericvn commented May 2, 2022

@christian-posta Thoughts on is this is ready to merge?

@christian-posta
Copy link
Contributor

yes @ericvn LGTM

Copy link
Contributor

@ericvn ericvn left a comment

Choose a reason for hiding this comment

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

Some possible minor changes.

@alexandrealvino
Copy link
Contributor Author

Just to emphasize that this PR depends on #37948

@alexandrealvino
Copy link
Contributor Author

/retest

@ericvn
Copy link
Contributor

ericvn commented May 5, 2022

LGTM. Once Christian responds in the sample PR, I think they can both merge.

@lei-tang
Copy link
Contributor

@istio/wg-docs-maintainers-english Can you approve and merge this PR? #11264 depends on this PR for the link /docs/ops/integrations/spire/. So this PR needs to be merged first before #11264.

Copy link
Contributor

@ericvn ericvn left a comment

Choose a reason for hiding this comment

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

Samples are now merged.

@istio-testing istio-testing merged commit 587e85a into istio:master May 16, 2022
- name: istio-proxy
volumeMounts:
- name: workload-socket
mountPath: /run/secrets/workload-spiffe-uds
Copy link

@hobbytp hobbytp Jun 5, 2022

Choose a reason for hiding this comment

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

@alexandrealvino @maxlambrecht Why it is /run/secrets/xxx instead of /var/run/secrets/xxx? Why remove the /var prefix? I know this /run/secrets/xxxx is aligned with spire-agent configmap configuration, but istio-agent only check /var/run/secrets/workload-spiffe-uds/socket as following shows, or I missed anything?

    WorkloadIdentitySocketPath = "./var/run/secrets/workload-spiffe-uds/socket"
...
	socketExists, err := checkSocket(ctx, security.WorkloadIdentitySocketPath)
	if err != nil {
		return nil, fmt.Errorf("failed to check SDS socket: %v", err)
	}

	if socketExists {
		log.Info("SDS socket found. Istio SDS Server won't be started")
	} else {
		log.Info("SDS socket not found. Starting Istio SDS Server")
		err = a.initSdsServer()
		if err != nil {
			return nil, fmt.Errorf("failed to start SDS server: %v", err)
		}
	}

Copy link
Contributor

Choose a reason for hiding this comment

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

/var/run is a symlink to /run

Copy link

Choose a reason for hiding this comment

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

ok, thanks for clarification.

$ kubectl exec -i -t $SPIRE_SERVER_POD -n spire -c spire-server -- /bin/sh -c "bin/spire-server entry show -socketPath /run/spire/sockets/server.sock"
Found 3 entries
Entry ID : c8dfccdc-9762-4762-80d3-5434e5388ae7
SPIFFE ID : spiffe://example.org/ns/istio-system/sa/istio-ingressgateway-service-account
Copy link

Choose a reason for hiding this comment

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

@alexandrealvino How about the TLS communication between istiod and istio-proxy? which kind of certification is used here?

Copy link
Contributor

Choose a reason for hiding this comment

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

The TLS communication between istiod and istio-agent uses a certificate generated by istiod itself, as per default behavior. That communication wasn't changed at all.

Copy link

Choose a reason for hiding this comment

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

The TLS communication between istiod and istio-agent uses a certificate generated by istiod itself, as per default behavior. That communication wasn't changed at all.

Thanks, in fact, my question is why not integrate istiod to SPIRE also. It will look more complete. Or will it be the next step or anything block this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's the next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/docs ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. 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.