<?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: Nishok Vishnu Ganesan</title>
    <description>The latest articles on DEV Community by Nishok Vishnu Ganesan (@nishok_vishnuganesan_1f7).</description>
    <link>https://dev.to/nishok_vishnuganesan_1f7</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%2F1078207%2Fda8a87af-7c83-474e-95f0-0f00abdfc3a0.png</url>
      <title>DEV Community: Nishok Vishnu Ganesan</title>
      <link>https://dev.to/nishok_vishnuganesan_1f7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nishok_vishnuganesan_1f7"/>
    <language>en</language>
    <item>
      <title>EKS Cluster Autoscaler and Testing</title>
      <dc:creator>Nishok Vishnu Ganesan</dc:creator>
      <pubDate>Sun, 27 Aug 2023 06:30:51 +0000</pubDate>
      <link>https://dev.to/nishok_vishnuganesan_1f7/eks-cluster-autoscaler-and-testing-1j7h</link>
      <guid>https://dev.to/nishok_vishnuganesan_1f7/eks-cluster-autoscaler-and-testing-1j7h</guid>
      <description>&lt;p&gt;To install the Kubernetes Cluster Autoscaler using the &lt;code&gt;terraform-aws-eks-cluster-autoscaler&lt;/code&gt; module from the &lt;code&gt;DNXLabs&lt;/code&gt; GitHub repository, you can follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clone the Terraform EKS Cluster Autoscaler Repository:&lt;/strong&gt;
Clone the repository to your local machine:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/DNXLabs/terraform-aws-eks-cluster-autoscaler.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Navigate to the Repository:&lt;/strong&gt;
Move into the cloned repository directory:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cd &lt;/span&gt;terraform-aws-eks-cluster-autoscaler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Update Variables:&lt;/strong&gt;&lt;br&gt;
Edit the &lt;code&gt;variables.tf&lt;/code&gt; file to set the required variables. You may need to provide values for variables like &lt;code&gt;cluster_name&lt;/code&gt;, &lt;code&gt;region&lt;/code&gt;, and others depending on your use case. Update these variables as needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Initialize Terraform:&lt;/strong&gt;&lt;br&gt;
Initialize Terraform in the repository directory:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Review and Apply:&lt;/strong&gt;
Review the changes that Terraform will make and then apply them:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm the changes when prompted.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configure Kubernetes Autoscaler:&lt;/strong&gt;&lt;br&gt;
After Terraform applies the changes, you need to configure your Kubernetes cluster to use the autoscaler. This may involve deploying the necessary Kubernetes resources (like Deployment or DaemonSet).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Verify Installation:&lt;/strong&gt;&lt;br&gt;
Check the pods running in the &lt;code&gt;kube-system&lt;/code&gt; namespace to ensure that the Cluster Autoscaler pods are up and running:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system | &lt;span class="nb"&gt;grep &lt;/span&gt;cluster-autoscaler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Testing and Monitoring:&lt;/strong&gt;
Test the behavior of the Cluster Autoscaler by deploying workloads that require additional nodes. Monitor the scaling activities and verify that nodes are added or removed as needed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Please note that the exact steps might vary based on your cluster configuration, Terraform version, and any changes made to the repository since my last update in September 2021. Always consult the repository's documentation and README for the most up-to-date instructions. Additionally, make sure to test any changes or new deployments in a non-production environment before applying them to production.&lt;/p&gt;

&lt;p&gt;Stress Testing:&lt;br&gt;
The YAML snippet you provided is a Kubernetes Deployment manifest for deploying an Nginx container with specific resource limits and requests, along with a nodeSelector.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-deployment&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
        &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;
            &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;8000Mi&lt;/span&gt;
          &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;
            &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;8000Mi&lt;/span&gt;
      &lt;span class="na"&gt;nodeSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;customLabel&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application&lt;/span&gt;  &lt;span class="c1"&gt;# Replace 'customLabel' with a label relevant to your nodes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;nodeSelector&lt;/code&gt; section, replace &lt;code&gt;customLabel&lt;/code&gt; with an actual label that you have applied to your nodes. This label should be used to specify on which nodes the pod should be scheduled.&lt;/p&gt;

&lt;p&gt;After making this adjustment, you can apply the manifest using &lt;code&gt;kubectl apply -f filename.yaml&lt;/code&gt;, assuming you have the Kubernetes CLI (&lt;code&gt;kubectl&lt;/code&gt;) installed and configured to access your cluster. Make sure to replace &lt;code&gt;filename.yaml&lt;/code&gt; with the actual name of the file containing this manifest.&lt;/p&gt;

</description>
      <category>eks</category>
      <category>devops</category>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Multiple Airflow deployment in Single DB</title>
      <dc:creator>Nishok Vishnu Ganesan</dc:creator>
      <pubDate>Sun, 07 May 2023 17:10:04 +0000</pubDate>
      <link>https://dev.to/nishok_vishnuganesan_1f7/multiple-airflow-deployment-in-single-db-2cpo</link>
      <guid>https://dev.to/nishok_vishnuganesan_1f7/multiple-airflow-deployment-in-single-db-2cpo</guid>
      <description>&lt;h2&gt;
  
  
  Problem Statement:
&lt;/h2&gt;

&lt;p&gt;Airflow deployments can use only one DB at the time. This is because, at the time of deployment, Airflow will create initial tables in &lt;code&gt;public&lt;/code&gt; schema as show in the figure&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---9XI5iMp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0xsaujz3g8loqbk7t5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---9XI5iMp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0xsaujz3g8loqbk7t5i.png" alt="Image description" width="616" height="1004"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So we can't create, another Airflow deployment in same DB. &lt;/p&gt;

&lt;h2&gt;
  
  
  Solution:
&lt;/h2&gt;

&lt;p&gt;Create a new schema with an unique user credential, grant all the privileges on the user credential to access the newly created schema. Then alter the search path of new user set to new schema. Finally add the schema name with DB user credentials in Airflow YAML deployment file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kYjbuHjd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xftgvy6e6kv5yhi84ilx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kYjbuHjd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xftgvy6e6kv5yhi84ilx.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Steps to achieve this:&lt;/p&gt;

&lt;h4&gt;
  
  
  Create a new schema and user credentials
&lt;/h4&gt;



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

CREATE USER nishok_ciapi WITH PASSWORD '***************';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Grant privileges queries
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GRANT ALL PRIVILEGES ON DATABASE postgres to nishok_ciapi;

GRANT SELECT ON ALL SEQUENCES IN SCHEMA airflow_ciapi TO nishok_ciapi;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA airflow_ciapi TO nishok_ciapi;

GRANT ALL ON ALL TABLES IN SCHEMA airflow_ciapi TO nishok_ciapi;
GRANT ALL ON ALL SEQUENCES IN SCHEMA  airflow_ciapi TO nishok_ciapi;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA airflow_ciapi TO s_ciapi;
nishok
GRANT CREATE ON SCHEMA airflow_ciapi TO nishok_ciapi;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Alter search path query
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
ALTER USER nishok_ciapi SET search_path = airflow_ciapi;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both the Schema in same DB&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GDmm5m4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/go61ys9yf5ejl41bs32o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDmm5m4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/go61ys9yf5ejl41bs32o.png" alt="Image description" width="616" height="1004"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rPiP5ngi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukmrvbzrcoa7sjl2wh9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rPiP5ngi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukmrvbzrcoa7sjl2wh9q.png" alt="Image description" width="688" height="954"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Sample YAML file for Airflow deployment
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;airflow:
  service:
    type: NodePort
  image: ********.dkr.ecr.us-east-1.amazonaws.com/***********
  tag: GIT_SHA
  nodeselector: airflow
  config:
    dags_folder: /root/airflow/dags
    s3_url: s3://airflow
    base_url: airflow.xyz.com
    schema: airflow_ciapi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>devops</category>
      <category>airflow</category>
      <category>backend</category>
      <category>database</category>
    </item>
  </channel>
</rss>
