Welcome to the comprehensive tutorial on configuring Argo Rollouts and Edge Stack API Gateway for seamless integration and efficient canary releases. All the necessary files for this guide can be found in the examples directory of the respective repository.
Note: If you are using Edge Stack or Emissary-ingress 2.0+, it is essential to install Argo-Rollouts version v1.1+ and include the argument --ambassador-api-version getambassador.io/v3alpha1
to your argo-rollouts
deployment.
If Edge Stack is not yet installed in your Kubernetes cluster, please refer to the Edge Stack documentation for detailed installation instructions.
By default, Edge Stack routes traffic through Kubernetes services. However, for optimal performance during canary releases, we recommend enabling endpoint routing. Follow the steps below to enable endpoint routing:
resolver.yaml
and save the provided configuration within it:
apiVersion: getambassador.io/v2
kind: KubernetesEndpointResolver
metadata:
name: endpoint
Apply the configuration to your cluster using the command: kubectl apply -f resolver.yaml
To proceed with canary releases, we need to create two Kubernetes services: echo-stable and echo-canary
. Follow the instructions below and save the resulting configuration in the echo-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: echo
name: echo-stable
---
spec:
type: ClusterIP
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080
selector:
app: echo
---
apiVersion: v1
kind: Service
metadata:
labels:
app: echo
name: echo-canary
spec:
type: ClusterIP
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080
selector:
app: echo
Additionally, we need to create an Edge Stack route for these services. Save the following configuration to a file named echo-mapping.yaml
kind: Mapping
metadata:
name: echo
spec:
prefix: /echo
rewrite: /echo
service: echo-stable:80
resolver: endpoint
Create a Rollout resource by saving the configuration to a file named rollout.yaml
. Take note of the trafficRouting
attribute, which directs Argo to use Edge Stack API Gateway for routing.
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: echo-rollout
spec:
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- image: hashicorp/http-echo
args:
- "-text=VERSION 1"
- -listen=:8080
imagePullPolicy: Always
name: echo-v1
ports:
- containerPort: 8080
strategy:
canary:
stableService: echo-stable
canaryService: echo-canary
trafficRouting:
ambassador:
mappings:
- echo
steps:
- setWeight: 30
- pause: {duration: 30s}
- setWeight: 60
- pause: {duration: 30s}
- setWeight: 100
- pause: {duration: 10}
Apply the rollout to your cluster using the command: kubectl apply -f rollout.yaml
. Note that this is the initial deployment, and no canary rollout will occur.
To ensure the successful implementation of the rollout, follow these steps:
export AMBASSADOR_LB_ENDPOINT=$(kubectl -n ambassador get svc ambassador -o "go-template={{range .status.loadBalancer.ingress}}{{or .ip .hostname}}{{end}}")
curl -Lk "https://$AMBASSADOR_LB_ENDPOINT/echo/"
You should receive a response indicating "VERSION 1
".
Now, let's roll out a new version of the service by updating the echo container in the rollout.yaml
file. Replace the existing configuration with the following content, which displays "VERSION 2
":
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: echo-rollout
spec:
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- image: hashicorp/http-echo
args:
- "-text=VERSION 2"
- -listen=:8080
imagePullPolicy: Always
name: echo-v1
ports:
- containerPort: 8080
strategy:
canary:
stableService: echo-stable
canaryService: echo-canary
trafficRouting:
ambassador:
mappings:
- echo