VK Cloud logo
Updated at April 15, 2024   08:50 AM

Configuring Canary Deployment Ingress

This article will help you deploy a Kubernetes cluster and configure Canary Deployment on it using Nginx Ingress Annotations: execute the Canary Deployment script for the echo server and make sure that traffic is distributed according to the configuration file.

Preparatory steps

  1. Create Kubernetes cluster in VK Cloud.

  2. Connect to the cluster using kubectl.

  3. Create a test application:

    1. Create a new namespace for the project:

      kubectl create ns echo-production
    2. Create a Kubernetes resource based on the manifest, for example, http-svc:

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/http-svc.yaml -n echo-production

1. Create an Ingress resource

  1. Create a manifest file http-svc.ingress with the following contents:

  2. Apply the manifest in the cluster:

    kubectl apply -f http-svc.ingress -n echo-production

    As a result, an application will be created and the server will respond to all requests from echo.com.

2. Create a copy of the deployed application

  1. Create a Canary version of the namespace for the application:

    kubectl create ns echo-canary
  2. Deploy the Canary version of the app:

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/http-svc.yaml -n echo-canary
  3. Create a Canary version of the Ingress configuration file:

  4. Apply the manifest in the cluster:

    kubectl apply -f http-svc.ingress.canary -n echo-canary

3. Check the performance of traffic distribution

  1. Connect to the cluster using Kubernetes Dashboard.

  2. Go to Namespaces.

  3. Switch the Namespace filter to All.

  4. At the bottom of the side menu, select Ingresses.

    A list of all available Ingresses will be displayed.

  5. Make sure that http-svc has one IP address specified in the Endpoints column.

  6. Check the distribution of requests according to the installed configuration by executing the script count.rb:

    ruby count.rb

Example of a successful result:

{"echo-production"=>896, "echo-canary"=>104}

Delete unused resources

A running cluster consumes computing resources. If you no longer need it: