<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ashutoshbhakare</title>
    <description>The latest articles on DEV Community by ashutoshbhakare (@ashutoshbhakare).</description>
    <link>https://dev.to/ashutoshbhakare</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F926170%2Fb5cdfe01-ac62-4d12-8fad-6f479cafecae.png</url>
      <title>DEV Community: ashutoshbhakare</title>
      <link>https://dev.to/ashutoshbhakare</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashutoshbhakare"/>
    <language>en</language>
    <item>
      <title>AWS EKS Ingress - Canary</title>
      <dc:creator>ashutoshbhakare</dc:creator>
      <pubDate>Thu, 28 Mar 2024 20:25:49 +0000</pubDate>
      <link>https://dev.to/ashutoshbhakare/aws-eks-ingress-canary-1hlp</link>
      <guid>https://dev.to/ashutoshbhakare/aws-eks-ingress-canary-1hlp</guid>
      <description>&lt;h2&gt;
  
  
  Dealing with Canary
&lt;/h2&gt;

&lt;p&gt;In this article I will be trying to explain, on how to create a canary deployment using AWS Application LoadBalancer using canary behavior &lt;/p&gt;

&lt;p&gt;We need to consider below pre-requisite before we deploy our application, (using AWS Cloud shell to do this demo)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Preinstalled eks cluster ( Ref: &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html&lt;/a&gt;) &lt;/li&gt;
&lt;li&gt;Helm Command should works on your AWS Cloud Shell ( Ref: &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/helm.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/helm.html&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;eksctl command is already installed in my case ( Ref: &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/lbc-helm.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/lbc-helm.html&lt;/a&gt;) &lt;/li&gt;
&lt;li&gt;AWS Load Balancer Controller Should be installed already ( Ref: &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/lbc-helm.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/lbc-helm.html&lt;/a&gt;) &lt;/li&gt;
&lt;li&gt;I have enabled subnet autodiscovery option by adding tags referred &lt;a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.1/deploy/subnet_discovery/" rel="noopener noreferrer"&gt;https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.1/deploy/subnet_discovery/&lt;/a&gt; 
Below is the graphical representation of my example 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zwzebc4o7v0gbschzuc.png" alt="Image description"&gt;
I have deployed two applications for doing this test, one is httpd running on 80 port number and the other one is hello-openshift running on 8080, this can be deployed using below commands &lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl create deployment mydep1 --image=docker.io/httpd
kubectl expose deployment mydep1 --port=80
kubectl create deployment mydep2 --image=docker.io/openshitf/hello-openshift
kubectl expose deployment mydep2 --port=8080


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We are using default service type called clusterIP as our ingress will point to these services, please refer the below screenshots&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjqk7m2gngglys1lj24jl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjqk7m2gngglys1lj24jl.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxh5eij3be3c9qa1xmlq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxh5eij3be3c9qa1xmlq.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
below is the yaml code for our ingress.yaml file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: "canary"
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/actions.blue-green: |
      {
        "type":"forward",
        "forwardConfig":{
          "targetGroups":[
            {
              "serviceName":"mydep1",
              "servicePort":"80",
              "weight":50
            },
            {
              "serviceName":"mydep2",
              "servicePort":"8080",
              "weight":50
            }
          ]
        }
      }
  labels:
    app: canary
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: blue-green
                port:
                  name: use-annotation


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;kubectl apply -f ingress.yaml can se used to deploy this , once deployed we will get output like below &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffn2c1hkbjxaan21ob6jm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffn2c1hkbjxaan21ob6jm.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now let's try to run the for loop to test the 50-50 percentage canary deployment&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyajv1m5ofq4zjn1gq7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyajv1m5ofq4zjn1gq7q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can clearly conclude the 50-50 load is getting distributed using the canary ingress. &lt;/p&gt;

&lt;p&gt;Note: I was facing issues while deploying EKS Load Balancer controller, by using kubectl logs -f -n kube-system -l app.kubernetes.io/instance=aws-load-balancer-controller command was able to conclude the error was coming due to subnet tags was missing. &lt;/p&gt;

&lt;p&gt;Happy Learning !!! &lt;/p&gt;

</description>
      <category>eks</category>
      <category>kubernetes</category>
      <category>canary</category>
      <category>cka</category>
    </item>
  </channel>
</rss>
