-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Create documentation for Argo Rollouts Plugin. #20680
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
wilkermichael
merged 8 commits into
main
from
ashwin-michael/add-docs-for-rollouts-plugin
Jun 24, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8c88e9e
Create documentation for Argo Rollouts Plugin.
thisisnotashwin 76b66cb
Create documentation for Argo Rollouts Plugin.
thisisnotashwin 9e36847
Apply suggestions from code review
d24cd6c
Apply suggestions from code review
5a2105c
Update docs based on feedback
thisisnotashwin c5d7394
Apply suggestions from code review
0c8cdda
Update website/content/docs/k8s/deployment-configurations/argo-rollou…
wilkermichael b11e148
Update website/content/docs/k8s/deployment-configurations/argo-rollou…
wilkermichael 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
262 changes: 262 additions & 0 deletions
262
website/content/docs/k8s/deployment-configurations/argo-rollouts-configuration.mdx
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,262 @@ | ||
| --- | ||
| layout: docs | ||
| page_title: Argo Rollouts Progressive Delivery with Consul on Kubernetes | ||
| description: >- | ||
| Configure the Argo Rollouts Controller to enable Canary deployments for subset-based routing. Learn how k8s Rollouts integrate with Consul's service mesh. | ||
| --- | ||
|
|
||
| # Argo Rollouts Progressive Delivery with Consul on Kubernetes | ||
|
|
||
| This page describes the process to configure and use the [Argo Rollouts Controller](https://argo-rollouts.readthedocs.io/en/stable/) with Consul on Kubernetes to manage advanced subset-based routing for Canary deployments. | ||
|
|
||
| Consul's support for Argo Rollouts is currently limited to subset-based routing. | ||
|
|
||
| ## Install Argo Rollouts Controller | ||
|
|
||
| There are three methods for installing the Argo Rollouts Controller with Consul on Kubernetes: | ||
|
|
||
| 1. [Install Rollouts Using Helm and init containers](#install-rollouts-using-helm-and-binary). We recommend installing the Argo Rollouts Controllor using this method. | ||
| 1. [Install Rollouts Using Helm and binary](#install-rollouts-using-helm-and-binary) | ||
| 1. [Standalone installation](#stand-alone-installation) | ||
|
|
||
| After installing the controller, you must [apply the RBAC CRD](https://raw.githubusercontent.com/argoproj-labs/rollouts-plugin-trafficrouter-consul/main/yaml/rbac.yaml) to your Kubernetes cluster. | ||
|
|
||
| ### Install Rollouts Using Helm and init containers | ||
|
|
||
| We recommend using this method to install this plugin. | ||
|
|
||
| Add the following code to your `values.yaml` file to configure the plugin: | ||
|
|
||
| ```yaml | ||
| controller: | ||
| initContainers: | ||
| - name: copy-consul-plugin | ||
| image: hashicorp/rollouts-plugin-trafficrouter-consul | ||
| command: ["/bin/sh", "-c"] | ||
| args: | ||
| # Copy the binary from the image to the rollout container | ||
| - cp /bin/rollouts-plugin-trafficrouter-consul /plugin-bin/hashicorp | ||
| volumeMounts: | ||
| - name: consul-plugin | ||
| mountPath: /plugin-bin/hashicorp | ||
| trafficRouterPlugins: | ||
| trafficRouterPlugins: |- | ||
| - name: "hashicorp/consul" | ||
| location: "file:///plugin-bin/hashicorp/rollouts-plugin-trafficrouter-consul" | ||
| volumes: | ||
| - name: consul-plugin | ||
| emptyDir: {} | ||
| volumeMounts: | ||
| - name: consul-plugin | ||
| mountPath: /plugin-bin/hashicorp | ||
| ``` | ||
|
|
||
| Then install the `argo-rollouts` and apply your updated values using Helm: | ||
|
|
||
| ```shell-session | ||
| $ helm install argo-rollouts argo/argo-rollouts -f values.yaml -n argo-rollouts | ||
| ``` | ||
|
|
||
| ### Install Rollouts Using Helm and binary | ||
|
|
||
| To build the binary and install Rollouts, complete the following steps: | ||
|
|
||
| 1. Build this plugin using your preferred tool. For example, `make build`. | ||
| 1. Mount the built plugin onto the `argo-rollouts` container. | ||
| 1. Add the following code to your `values.yaml` file to configure the plugin: | ||
|
|
||
| ```yaml | ||
| controller: | ||
| trafficRouterPlugins: | ||
| trafficRouterPlugins: |- | ||
| - name: "argoproj-labs/consul" | ||
| location: "file:///plugin-bin/hashicorp/rollouts-plugin-trafficrouter-consul" | ||
| volumes: | ||
| - name: consul-route-plugin | ||
| hostPath: | ||
| # The path being mounted to, change this depending on your mount path | ||
| path: /rollouts-plugin-trafficrouter-consul | ||
| type: DirectoryOrCreate | ||
| volumeMounts: | ||
| - name: consul-route-plugin | ||
| mountPath: /plugin-bin/hashicorp | ||
| ``` | ||
|
|
||
| Then install the `argo-rollouts` and apply your updated values using Helm: | ||
|
|
||
| ```shell-session | ||
| $ helm install argo-rollouts argo/argo-rollouts -f values.yaml -n argo-rollouts | ||
| ``` | ||
|
|
||
| ### Stand-alone installation | ||
|
|
||
| This section describes the process to create a stand-alone installation. These instructions are for illustrative purposes. We recommend using init containers to create and install this plugin. | ||
|
|
||
| To create a stand-alone installation of the Rollouts plugin, complete the following steps: | ||
|
|
||
| 1. Build this plugin. | ||
| 1. Put the plugin on the path and mount it to the `argo-rollouts`container. | ||
| 1. Create a `ConfigMap` to configure `argo-rollouts` with the plugin's location. | ||
|
|
||
| The following example schedules a Deployment and mounts it to the `argo-rollouts` container: | ||
|
|
||
| ```yaml | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: argo-rollouts | ||
| namespace: argo-rollouts | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: argo-rollouts | ||
| template: | ||
| spec: | ||
| # ... | ||
| volumes: | ||
| # ... | ||
| - name: consul-plugin | ||
| hostPath: | ||
| path: /plugin-bin/hashicorp/rollouts-plugin-trafficrouter-consul | ||
| type: DirectoryOrCreate | ||
| containers: | ||
| - name: argo-rollouts | ||
| # ... | ||
| volumeMounts: | ||
| - name: consul-route-plugin | ||
| mountPath: /plugin-bin/hashicorp | ||
|
|
||
| ``` | ||
|
|
||
| The following example creates the `ConfigMap` with the location of the plugin: | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: argo-rollouts-config | ||
| namespace: argo-rollouts | ||
| data: | ||
| trafficRouterPlugins: |- | ||
| - name: "argoproj-labs/consul" | ||
| location: "file:///plugin-bin/hashicorp/rollouts-plugin-trafficrouter-consul" | ||
| binaryData: {} | ||
| ``` | ||
thisisnotashwin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Install the RBAC | ||
|
|
||
| After either mounting the binary or using an init container, configure an RBAC using [Argo Rollout Consul plugin `rbac.yaml`](https://raw.githubusercontent.com/argoproj-labs/rollouts-plugin-trafficrouter-consul/main/yaml/rbac.yaml): | ||
|
|
||
| ```shell-session | ||
| $ kubectl apply -f https://raw.githubusercontent.com/argoproj-labs/rollouts-plugin-trafficrouter-consul/main/yaml/rbac.yaml | ||
| ``` | ||
|
|
||
| ## Use the Argo Rollouts Consul plugin | ||
|
|
||
| Schedule the Kubernetes Service utilized by the service being rolled out. Additionally, configure any service defaults and proxy defaults required for the service. | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: test-service | ||
| spec: | ||
| selector: | ||
| app: test-service | ||
| ports: | ||
| - name: http | ||
| port: 80 | ||
| targetPort: 8080 | ||
| ``` | ||
|
|
||
| Next, create the service resolver and service splitter CRDs for your stable service. Argo automatically modifies these CRDs during canary deployments. | ||
|
|
||
| The following example demonstrates the configuration of the service resolver CRD, which creates service subsets and sets the stable subset as the default: | ||
|
|
||
| ```yaml | ||
| apiVersion: consul.hashicorp.com/v1alpha1 | ||
| kind: ServiceResolver | ||
| metadata: | ||
| name: test-service | ||
| spec: | ||
| subsets: | ||
| stable: | ||
| filter: Service.Meta.version == 1 | ||
| canary: | ||
| filter: "" | ||
| defaultSubset: stable | ||
| ``` | ||
|
|
||
| The following example demonstrates the configuration of the service splitter CRD, which initially sends 100% of traffic to the stable deployment: | ||
|
|
||
| ```yaml | ||
| apiVersion: consul.hashicorp.com/v1alpha1 | ||
| kind: ServiceSplitter | ||
| metadata: | ||
| name: test-service | ||
| spec: | ||
| splits: | ||
| - weight: 100 | ||
| serviceSubset: stable | ||
| - weight: 0 | ||
| serviceSubset: canary | ||
| ``` | ||
|
|
||
| Then configure your Argo Rollout resource to incrementally rollout the canary deployment: | ||
|
|
||
| ```yaml | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Rollout | ||
| metadata: | ||
| name: test-service | ||
| spec: | ||
| replicas: 3 | ||
| selector: | ||
| matchLabels: | ||
| app: test-service | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: test-service | ||
| annotations: | ||
| consul.hashicorp.com/connect-inject: "true" | ||
| consul.hashicorp.com/service-meta-version: "1" | ||
| consul.hashicorp.com/service-tags: "v1" | ||
| spec: | ||
| containers: | ||
| - name: test-service | ||
| # Using alpine vs latest as there is a build issue with M1s. Also other tests in multiport-app reference | ||
| # alpine so standardizing this. | ||
| image: docker.mirror.hashicorp.services/hashicorp/http-echo:alpine | ||
| args: | ||
| - -text="I am v1" | ||
| - -listen=:8080 | ||
| ports: | ||
| - containerPort: 8080 | ||
| name: http | ||
| serviceAccountName: test-service | ||
| terminationGracePeriodSeconds: 0 # so deletion is quick | ||
| strategy: | ||
| canary: | ||
| trafficRouting: | ||
| plugins: | ||
| hashicorp/consul: | ||
| stableSubsetName: stable # subset name of the stable service | ||
| canarySubsetName: canary # subset name of the canary service | ||
| serviceName: test-service | ||
| steps: | ||
| - setWeight: 20 | ||
| - pause: {} | ||
| - setWeight: 40 | ||
| - pause: {duration: 10} | ||
| - setWeight: 60 | ||
| - pause: {duration: 10} | ||
| - setWeight: 80 | ||
| - pause: {duration: 10} | ||
| ``` | ||
|
|
||
| Finally, perform the Rollout operation using the Argo Rollouts Kubectl plugin. | ||
|
|
||
| ```shell-session | ||
| $ kubectl argo rollouts promote test-service | ||
| ``` | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.