-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create documentation for Argo Rollouts Plugin.
- Loading branch information
1 parent
53afd8f
commit 0cf4d1a
Showing
2 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
221 changes: 221 additions & 0 deletions
221
website/content/docs/k8s/deployment-configurations/argo-rollouts-configuration.mdx
This file contains 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,221 @@ | ||
--- | ||
layout: docs | ||
page_title: Using Argo Rollouts for Canary upgrades with Consul on Kubernetes | ||
description: >- | ||
Configuration for Argo Rollouts Controller to enable Canary deployments for subset based routing using Rollouts to integrate with Consul Service Mesh. | ||
--- | ||
|
||
NOTES: | ||
**_1. Currently, the Consul Traffic Routing Rollouts Plugin only supports subset based routing._** | ||
|
||
### Install Rollouts Using Helm (Init Container) | ||
This is the preferred method for installing this plugin. | ||
|
||
Add the following code to your `values.yaml` file, then install the argo-rollouts by helm: | ||
|
||
```yaml | ||
initContainers: | ||
- name: copy-consul-plugin | ||
image: <TODO Insert Release Image> | ||
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 | ||
``` | ||
```bash | ||
helm install argo-rollouts argo/argo-rollouts -f values.yaml -n argo-rollouts | ||
``` | ||
|
||
### Install Rollouts Using Helm (Binary) | ||
|
||
1. Build this plugin (i.e. `make build`). | ||
2. Mount the built plugin on to the `argo-rollouts` container | ||
3. Add the following code to your `values.yaml` file, then install the argo-rollouts by helm: | ||
|
||
```yaml | ||
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 | ||
``` | ||
```bash | ||
helm install argo-rollouts argo/argo-rollouts -f values.yaml -n argo-rollouts | ||
``` | ||
|
||
### Stand-alone installation | ||
|
||
NOTES: | ||
**_1. The file as follows (and the codes in it) just for illustrative purposes only, please do not use directly!_** | ||
|
||
Steps: | ||
|
||
1. Build this plugin. | ||
2. Put the plugin on the path & mount onto the `argo-rollouts`container (please refer to the example YAML below to modify the deployment) | ||
3. Create a ConfigMap to configure `argo-rollouts` with the plugin's location: | ||
|
||
```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 | ||
|
||
``` | ||
```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: {} | ||
``` | ||
### Install the RBAC | ||
After either mounting the binary or using an init container apply the RBAC using the provided `yaml/rbac.yaml` | ||
```bash | ||
kubectl apply -f https://github.com/raw/argoproj-labs/rollouts-plugin-trafficrouter-consul/main/yaml/rbac.yaml | ||
``` | ||
|
||
## Usage | ||
|
||
1. Create the Kubernetes Service that will be 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 | ||
``` | ||
|
||
1. Create the Service Resolver and Service Splitter CRDs for your stable and canary services. | ||
```yaml | ||
apiVersion: consul.hashicorp.com/v1alpha1 | ||
kind: ServiceResolver | ||
metadata: | ||
name: test-service | ||
spec: | ||
subsets: | ||
stable: | ||
filter: Service.Meta.version == 1 | ||
canary: | ||
filter: "" | ||
defaultSubset: stable | ||
``` | ||
```yaml | ||
apiVersion: consul.hashicorp.com/v1alpha1 | ||
kind: ServiceSplitter | ||
metadata: | ||
name: test-service | ||
spec: | ||
splits: | ||
- weight: 100 | ||
serviceSubset: stable | ||
- weight: 0 | ||
serviceSubset: canary | ||
``` | ||
|
||
1. Configure your Argo Rollout resource | ||
```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} | ||
``` | ||
|
||
1. Perform the Rollout operation using the Argo Rollouts Kubectl plugin. |
This file contains 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