<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mathinisha Ravi on Medium]]></title>
        <description><![CDATA[Stories by Mathinisha Ravi on Medium]]></description>
        <link>https://medium.com/@mathinisharavi?source=rss-d74733770c20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BqZ4uZRUjszFHzsO02yavA.jpeg</url>
            <title>Stories by Mathinisha Ravi on Medium</title>
            <link>https://medium.com/@mathinisharavi?source=rss-d74733770c20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:27:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mathinisharavi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploying Applications On EC2 with AWS CodeDeploy in a Jenkins CI/CD Pipeline]]></title>
            <link>https://medium.com/@mathinisharavi/deploying-applications-on-ec2-with-aws-codedeploy-in-a-jenkins-ci-cd-pipeline-d212302e8c04?source=rss-d74733770c20------2</link>
            <guid isPermaLink="false">https://medium.com/p/d212302e8c04</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[codedeploy]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Mathinisha Ravi]]></dc:creator>
            <pubDate>Tue, 04 Mar 2025 09:40:51 GMT</pubDate>
            <atom:updated>2025-03-04T09:40:51.858Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3A0zWPjllwtejKkGgvR6Dw.jpeg" /></figure><p>In modern software development, continuous integration and continuous deployment (CI/CD) are essential for delivering applications efficiently. AWS CodeDeploy, when integrated with Jenkins, enables seamless deployments to Amazon EC2 instances.</p><p>This guide walks you through setting up a Jenkins CI/CD pipeline that builds, tests, and deploys a node.js application on EC2 using AWS CodeDeploy.</p><h3>Why AWS CodeDeploy for EC2 ?</h3><ul><li><strong>Automated Deployments-</strong>Reduces manual intervention and minimizes deployment risks.</li><li><strong>Scalability-</strong>Works with multiple EC2 instances across different environments (UAT, Production).</li><li><strong>Integration with CI/CD tools -</strong>Seamlessly Integrates with third-party tools like Jenkins, Github as well as AWS services like CodePipeline, CodeBuild</li><li><strong>Zero Downtime Deployments -</strong>Supports Blue/Green and Rolling updates for high availability.</li></ul><h3>Prerequisites</h3><ul><li>A Jenkins server ( Running on EC2 Instance)</li><li>An S3 Bucket for storing deployment Artifacts</li><li>AWS IAM roles with necessary permissions for S3, EC2, CodeDeploy</li><li>An EC2 Deployment Group in AWS CodeDeploy</li></ul><h3>Creating Deployment Groups in AWS CodeDeploy</h3><p>Before initiating your application deployment, it’s important to configure deployment groups in AWS CodeDeploy. These groups determine the EC2 instances that will receive the application updates.</p><h4>Step1: Create an Application in CodeDeploy</h4><ol><li>Log into the AWS Management Console and navigate to AWS CodeDeploy.</li><li>Click on Create application.</li><li>Choose a name for your Application (eg: nodejs-application).</li><li>Select EC2/On-premises for the Compute platform.</li><li>Click Create application .</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jic_z5Ll8wBUPVyzjpb6MQ.png" /></figure><h4>Step2: Set Up a Deployment Group</h4><ol><li>Go to the newly created application in the AWS CodeDeploy Console</li><li>Click on Create deployment group.</li><li>Enter a Deployment Group name:</li></ol><ul><li>For UAT, example: use something like “nodejs-uat”</li><li>For Production, example: use “nodejs-prod”</li></ul><p>4. Under Service Role, choose or create an IAM Role that grants AWS CodeDeploy the necessary permissions to interact with EC2 instances.</p><p>5. Select your desired Deployment type:</p><ul><li>In-place deployment for replacing the current application version on your EC2 instances.</li><li>Blue/Green deployment for seamless deployments with zero down time.</li></ul><p>6. Configure the Environment by selecting the EC2 instances where the deployment will happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bW8VZ8_LF9SQJ8Kjw2bfQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ygtg8tYx2sSx1R54ybP-IA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVIE7JAazaB4LX-RJ3yXoQ.png" /></figure><p>7. Set EC2 Tag key and specify its values.</p><p>8. Complete the process by clicking Create deployment group.</p><h3>Jenkins Pipeline for AWS CodeDeploy on EC2</h3><h4>Pipeline Overview:</h4><p>The pipeline will:</p><ol><li><strong>Fetch the latest code</strong> from the github repository.</li><li><strong>Prepare and upload environment-specific</strong> appspec.yml files to an S3 bucket</li><li><strong>Uploads deployment Artifacts</strong> to S3.</li><li><strong>Triggers AWS CodeDeploy</strong> to deploy the application to UAT instances.</li><li><strong>Wait for manual approval</strong> before proceeding to Production.</li><li><strong>Deploy the application to Production EC2 instances</strong> using AWS CodeDeploy.</li></ol><h4>appspec.yml file for UAT / Prod environment</h4><pre>version: 0.0<br>os: linux<br>files: <br>  - source: /<br>    destination: /home/ec2-user/nodejs<br>hooks: <br>  ApplicationStop:<br>    - location: scripts/application_stop.sh<br>      timeout: 300<br>      runas: ec2-user<br>  BeforeInstall:<br>    - location: scripts/before_install.sh<br>      timeout: 300<br>      runas: ec2-user<br>  ApplicationStart:<br>    - location: scripts/application_start.sh<br>      timeout: 300<br>      runas: ec2-user</pre><h4>Scripts for UAT/Prod environment</h4><p>application_start.sh</p><pre>#! /bin/bash<br><br>#give permisssion for everything in the directory<br>sudo chmod -R 777 /home/ec2-user/nodejs<br><br>#navigate into our working directory where we have all our github files<br>cd /home/ec2-user/nodejs<br><br>#add npm and node to path<br>export NVM_DIR=&quot;$HOME/.nvm&quot;<br>[ -s &quot;$NVM_DIR/nvm.sh&quot; ] &amp;&amp; \. &quot;$NVM_DIR/nvm.sh&quot;  # loads nvm <br>[ -s &quot;$NVM_DIR/bash_completion&quot; ] &amp;&amp; \. &quot;$NVM_DIR/bash_completion&quot;  # loads nvm bash_completion (node is in path now)<br><br>#install node modules <br>npm install<br><br>#start our node app in the background<br>npm start &gt; app.out.log 2&gt; app.err.log &lt; /dev/null &amp;</pre><p>application_stop.sh</p><pre>#! /bin/bash<br>stopping existing node servers<br>echo &quot;Stopping any existing node servers<br>pkill node</pre><p>before_install.sh</p><pre>#!/bin/bash<br><br>#download node and npm<br>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash<br>. ~/.nvm/nvm.sh<br>nvm install node<br><br>#create our working directory if it doesnt exist<br>DIR=&quot;/home/ec2-user/nodejs&quot;<br>if [ -d &quot;$DIR&quot; ]; then<br>  echo &quot;${DIR} exists&quot;<br>else<br>  echo &quot;Creating ${DIR} directory&quot;<br>  mkdir ${DIR}<br>fi</pre><h4>Jenkins Pipeline Script</h4><pre>pipeline {<br>    agent any<br>    environment {<br>       S3_BUCKET = &#39;nodejs-jenkins-artifact&#39;<br>       AWS_REGION = &#39;ap-south-1&#39;<br>       APPLICATION_NAME = &#39;nodejs-application&#39;<br>       DEPLOYMENT_GROUP_NAME_UAT = &#39;nodejs-uat&#39;<br>       DEPLOYMENT_GROUP_NAME_PROD = &#39;nodejs-prod&#39;<br>       SERVICE_NAME = &#39;service-a&#39;<br>    }<br>    stages {<br>        <br>        stage(&#39;Checkout Code&#39;) {<br>            steps {<br>            git branch: &#39;main&#39;, url: &#39;&lt;you code repo url&gt;&#39;<br>            }<br>        }<br>        <br>        stage(&#39;Prepare Deployment Files&#39;) {<br>            steps {<br>                script {<br>                    sh &quot;&quot;&quot;<br>                    aws s3 cp s3://${S3_BUCKET}/${SERVICE_NAME}/uat/appspec.yml ${WORKSPACE}/appspec.${DEPLOYMENT_GROUP_NAME_UAT}.yml<br>                    aws s3 cp --recursive s3://${S3_BUCKET}/${SERVICE_NAME}/uat/scripts/ ${WORKSPACE}/scripts-uat/<br>        <br>                    aws s3 cp s3://${S3_BUCKET}/${SERVICE_NAME}/prod/appspec.yml ${WORKSPACE}/appspec.${DEPLOYMENT_GROUP_NAME_PROD}.yml<br>                    aws s3 cp --recursive s3://${S3_BUCKET}/${SERVICE_NAME}/prod/scripts ${WORKSPACE}/scripts-prod/<br><br>                    chmod +x ${WORKSPACE}/scripts-uat/*.sh<br>                    chmod +x ${WORKSPACE}/scripts-prod/*.sh<br>        <br>                    chmod +x ${WORKSPACE}/appspec.${DEPLOYMENT_GROUP_NAME_UAT}.yml<br>                    chmod +x ${WORKSPACE}/appspec.${DEPLOYMENT_GROUP_NAME_PROD}.yml<br>                    &quot;&quot;&quot;<br>                }<br>          <br>            }<br><br>        }<br>    <br>        stage(&#39;Build &amp; Test&#39;) {<br>            steps {<br>            sh &#39;npm install&#39;<br>            sh &#39;npm test || true&#39;<br>            }<br>        }<br><br>        stage(&#39;Deploy to UAT&#39;) {<br>            steps {<br>                script {<br>                    step([$class: &#39;AWSCodeDeployPublisher&#39;,<br>                    applicationName: &quot;${APPLICATION_NAME}&quot;,<br>                    deploymentGroupName: &quot;${DEPLOYMENT_GROUP_NAME_UAT}&quot;,<br>                    region: &quot;${AWS_REGION}&quot;,<br>                    deploymentMethod: &#39;deploy&#39;,<br>                    waitForCompletion: true,<br>                    s3bucket: &quot;${S3_BUCKET}&quot;,<br>                    s3prefix: &quot;${SERVICE_NAME}/uat/&quot;,<br>                    deploymentGroupAppspec: true<br>                    ])<br>                }<br>            }<br><br>        }<br>                    <br>    <br>        stage(&#39;Approval for Production&#39;) {<br>            steps {<br>                input(message: &#39;Approve deployment to Production?&#39;, ok: &#39;Approve&#39;)<br>            }<br>        }             <br>    <br>        stage(&#39;Deploy to Production&#39;) {<br>            steps {<br>                script {<br>                    step([$class: &#39;AWSCodeDeployPublisher&#39;,<br>                    applicationName: &quot;${APPLICATION_NAME}&quot;,<br>                    deploymentGroupName: &quot;${DEPLOYMENT_GROUP_NAME_PROD}&quot;,<br>                    region: &quot;${AWS_REGION}&quot;,<br>                    deploymentMethod: &#39;deploy&#39;,<br>                    waitForCompletion: true,<br>                    s3bucket: &quot;${S3_BUCKET}&quot;,<br>                    s3prefix: &quot;${SERVICE_NAME}/prod/&quot;,<br>                    deploymentGroupAppspec: true<br>                    ])<br>                }<br>            }<br>        }  <br>    }  <br>}</pre><h4>Verifying the Deployments</h4><p>Once the Jenkins pipeline successfully completes, the application will be deployed to an EC2 instance. To access it follow these steps:</p><ol><li>Go to AWS Console &gt; EC2 dashboard.</li><li>Find the EC2 instance where the application is deployed.</li><li>Copy the Public IP address of the instance.</li><li>Open a web browser and enter:</li></ol><pre>http://&lt;EC2-PUBLIC_IP&gt;:&lt;PORT&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORAzG64mxvWiOErL5zHaYA.png" /></figure><h4>How AWS CodeDeploy Automates EC2 Deployments</h4><p>Once the deployments starts, AWS CodeDeploy executes the following steps:</p><ol><li>Fetches deployment artifacts from the S3 bucket.</li><li>Copies application files to the EC2 instances.</li><li>Executes life cycle hooks defined in appspec.yml (eg: BeforeInstall, AfterInstall)</li><li>Performs health checks to verify deployment success.</li><li>Handles rollback if deployment fails.</li></ol><h4>Benefits of EC2 Deployment with AWS CodeDeploy and Jenkins.</h4><ol><li>AWS CodeDeploy automates and simplifies EC2 deployments.</li><li>Separate appspec.yml files ensures environment-specific configuration for UAT and Production.</li><li>Jenkins CI/CD Pipeline automates application deployments to EC2 instances via AWS CodeDeploy</li><li>Approval provides an extra layer of security before pushing to Production.</li></ol><p>By Integrating AWS CodeDeploy with Jenkins, organizations can acheive a highly efficient CI/CD pipeline for EC2 deployments. This setup ensures that applications are deployed automatically, with minimal downtime, across different environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d212302e8c04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EKS Backups made easy with Velero for Disaster Recovery]]></title>
            <link>https://blog.searce.com/eks-backups-made-easy-with-velero-for-disaster-recovery-c9090c3ba619?source=rss-d74733770c20------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9090c3ba619</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[velero]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Mathinisha Ravi]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 12:07:33 GMT</pubDate>
            <atom:updated>2025-02-06T06:12:11.122Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z6kcBqjYP-6JTo28vkMPfA.png" /></figure><p>Disaster recovery is important when managing Amazon EKS Cluster, especially for production environments. A good backup solution helps protect your data, keeps the cluster stable, and reduces the risks of unexpected issues.</p><p>Velero is an open source tool, simplifies backing up, restoring, and migrating EKS clusters.</p><p>In this blog, we’ll guide you through setting up Velero to backup and restore your EKS cluster, ensuring your applications and data stay safe.</p><p>When backing up your cluster, there are two important things to remember :</p><ul><li>ETCD key-value store, which holds all the configuration details of the cluster.</li><li>Persistent Volumes which stores the data of the application running in the cluster.</li></ul><p>So both of these need to be included in the backup.</p><h4><strong>Prerequisites</strong></h4><ul><li>EKS Cluster(v1.31)</li><li>EKSCTL (v0.191.0) should be available on the local machine.</li><li>KUBECTL (v1.31.0) should be available on the local machine.</li><li>AWS CLI (v2.18.10) should be available on the local machine and configured with required permissions.</li><li>Helm(v3.16.1) should be available on your local system.</li><li>Amazon EBS CSI driver must be installed on each cluster.</li></ul><h4><strong>Step:1 Create an S3 Bucket for Velero Backups</strong></h4><p>We need a storage solution for backup the cluster components. In this case, we’ll use Amazon S3. To create an S3 bucket, you can use the following CLI command or by using the AWS management console.</p><pre>BUCKET_NAME=&quot;eks-backup-cluster&quot; #replace with your desired bucket name<br>REGION=ap-south-1 #set your preferred region</pre><pre>aws s3 mb s3://${BUCKET_NAME} --region ${REGION}</pre><p>Verify the bucket has been created with appropriate settings.</p><h4>Step:2 Creating an IAM Policy for Velero</h4><p>An IAM policy with required permissions is necessary because velero needs to communicate with various AWS services. This is required for tasks like taking snapshots of EBS volumes and storing other cluster components data on S3.</p><p>Use the permissions below to create the IAM policy</p><pre>cat &lt;&lt; EOF | envsubst &gt; velero_policy.json<br>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;ec2:DescribeVolumes&quot;,<br>                &quot;ec2:DescribeSnapshots&quot;,<br>                &quot;ec2:CreateTags&quot;,<br>                &quot;ec2:CreateSnapshot&quot;,<br>                &quot;ec2:DeleteSnapshots&quot;   <br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        },<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:GetObject&quot;,<br>                &quot;s3:DeleteObject&quot;,<br>                &quot;s3:PutObject&quot;,<br>                &quot;s3:AbortMultipartUpload&quot;,<br>                &quot;s3:ListMultipartUploadParts&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:s3:::${BUCKET_NAME}/*&quot;<br>            ]<br>        },<br>        { <br>            &quot;Effect&quot;:&quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:ListBucket&quot;<br>            ],<br>            &quot;Resource&quot;:[<br>                &quot;arn:aws:s3:::${BUCKET_NAME}&quot;<br>            ]<br>        }<br>    ]<br>        <br>}<br><br>EOF</pre><p>The IAM policy will be created with the S3 bucket name, so make sure to enter your bucket name correctly. After the JSON file is created, we can create the IAM policy using the following command.</p><pre>export POLICY_NAME=VeleroAccessPolicy</pre><pre>aws iam create-policy \<br>  --policy-name $POLICY_NAME \<br>  --policy-document file://velero_policy.json</pre><p>You will see the IAM policy details in the output once it is created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gQKMYo0NkdShL96h" /></figure><p>To retrieve the ARN of the created IAM policy, use the following command:</p><pre>export POLICY_ARN=$(aws iam list-policies --query &quot;Policies[?PolicyName==&#39;$POLICY_NAME&#39;].Arn&quot; --output text)</pre><p>You can also use the AWS IAM console to verify that the IAM policy has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qX3XwzuxTGCiYsifhd-qSQ.png" /></figure><h4>Step:3 Creating an IAM role for Velero</h4><p>The first setup is to create a JSON file defining the trust relationship for the IAM role</p><pre>cat &lt;&lt;EOF &gt; trust-policy.json<br>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>      {<br>        &quot;Effect&quot;: &quot;Alllow&quot;,<br>        &quot;Principal&quot;: {<br>          &quot;Service&quot;: &quot;pods.eks.amazonaws.com&quot;<br>        },<br>        &quot;Action&quot;: [<br>          &quot;sts:AssumeRole&quot;,<br>          &quot;sts:TagSession&quot;  <br>        ]<br>      } <br>    ]<br>}<br>EOF</pre><p>To grant the velero pods access to the aws services, we will use the EKS Pod Idenity Agent to provide the AWS credentials.</p><p>Next, create an IAM role with this trust policy defined in the JSON file using the below command.</p><pre>export ROLE_NAME=VeleroAccessRole</pre><pre>aws iam create-role \<br> --role-name $ROLE_NAME \<br> --assume-role-policy-document file://trust-policy.json</pre><p>After creation you can see the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OaH3y38awnDg3v2C7RCZ2g.png" /></figure><p>Next, we need to attach this policy to the IAM role we have created. Follow the below command:</p><pre>aws iam attach-role-policy \<br> --role-name $ROLE_NAME \<br> --policy-arn $POLICY_ARN</pre><p>You can also use the AWS IAM console to verify that the IAM Role has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dgarl1RBpYjj9ZT9wsD2Yg.png" /></figure><p>You can Check the Trust Relationship as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXy_a3Q0qYdmDStdNQsIiA.png" /></figure><p>Follow the below command to save the Role ARN as an environment variable for next configuration.</p><pre>export ROLE_ARN=$(aws iam get-role --role-name $ROLE_NAME --query &quot;Role.Arn&quot; --output text)</pre><h4>Step:4 Associating Pod Identity</h4><p>Access your EKS Cluster.</p><p>Before associating the pod identity, you need to create a namespace and service account for Velero within the EKS cluster. Follow the below commands:</p><pre>export NAMESPACE=velero<br>export SERVICE_ACCOUNT=velero-server</pre><pre>kubectl create ns $NAMESPACE<br>kubectl -n $NAMESPACE create sa $SERVICE_ACCOUNT</pre><p>To list the service accounts in specific namespace.</p><pre>kubectl -n $NAMESPACE get sa </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j9e9DAY5ueRf55EH" /></figure><p>Setting up for pod identity Association, before create an environment variable to store the cluster name and ensure the Pod Identity Agent is present in the cluster.</p><p>Set the cluster name as an environment variable using the command below:</p><pre>export CLUSTER_NAME=velero-1-eks # your-cluster-name</pre><p>To list the available addons in the cluster, use:</p><pre>aws eks list-addons --cluster-name $CLUSTER_NAME</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZFE_7JlUkomqx7EWS3SvUA.png" /></figure><p>If the Pod Identity Agent is not present, add it to the cluster with following command:</p><pre>aws eks create-addon --cluster-name $CLUSTER_NAME --addon-name eks-pod-identity-agent</pre><p>Following the below command, now we can perform the Pod Identity Association.</p><pre>eksctl create podidentityassociation \<br>  --cluster $CLUSTER_NAME \<br>  --namespace $NAMESPACE \<br>  --service-account-name $SERVICE_ACCOUNT \<br>  --role-arn $ROLE_ARN</pre><p>We can list the pod identity associations to confirm everything is set up correctly by following this command:</p><pre>aws eks list-pod-identity-associations --cluster-name $CLUSTER_NAME</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uk4Eg5FF4iOLLlzY" /></figure><p>The above output shows the Pod Identity is successfully associated with the Velero Service Account.</p><h4>Step:5 Deploying Velero on EKS Cluster</h4><p>To deploy velero on EKS Cluster, we will use the Helm chart. Start by adding the Velero Helm chart repository:</p><pre>helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts/</pre><p>A values.yaml file is required to customize the configuration.</p><pre>helm search repo vmware-tanzu</pre><p>Below command will display the chart name along with additional details.</p><pre>helm show values vmware-tanzu/velero</pre><p>You can copy the entire output into a file or select only the necessary fields to create a customized values.yaml file. For this example, only necessary configuration will be included in a new yaml file.</p><p>Set the provider as an environment variable (AWS in this case)</p><pre>export PROVIDER=aws</pre><p>Create a configuration file (new-values.yaml) by substituting the necessary variables:</p><pre>cat &lt;&lt; EOF |envsubst &gt; new-values.yaml<br>initContainers:<br>  - name: velero-plugin-for-aws<br>    image: velero/velero-plugin-for-aws:v1.10.0<br>    imagePullPolicy: IfNotPresent<br>    volumeMounts:<br>      - mountPath: /target<br>        name: plugins<br><br>configuration:<br>  backupStorageLocation:<br>    -provider: ${PROVIDER}<br>     bucket: ${BUCKET_NAME}<br>     config:<br>      region: ${REGION}<br>  volumeSnapshotLocation:<br>    -provider: ${PROVIDER}<br>     config:<br>      region: ${REGION}<br><br>serviceAccount:<br>  server:<br>   create: false<br>   name: ${SERVICE_ACCOUNT}<br><br>credentials:<br>  useSecret: false<br>EOF</pre><p>Ensure the S3 BUCKET_NAME, REGION,SERVICE_ACCOUNT and PROVIDER are accurately defined in the YAML file.</p><p>To install Velero using Helm, run the following command</p><pre>helm install velero vmware-tanzu/velero \<br>  --namespace velero \<br>  -f new-values.yaml</pre><p>Once the deployment is complete, you can verify the created objects:</p><pre>kubectl -n &lt;NAMESPACE&gt; get all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XILamYKf8SprdvJW" /></figure><p>For more information we can describe the pod by the following command:</p><pre>kubectl -n &lt;NAMESPACE&gt; describe po &lt;POD NAME&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*255HDeERB9J7d1y_" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kKlv4zwqYUetWp18" /></figure><p>The output shows how the pod identity agent assigns temporary AWS credentials to the Velero pod enabling it to interact with the AWS services.</p><p>Velero relies on Custom Resource Definitions (CRDs) for backup, restore, and scheduling operations. To view available CRDs, run the following command:</p><pre>kubectl -n &lt;NAMESPACE&gt; get crds | grep velero</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tx05Rp3U-LjK-r5A" /></figure><p>Backup storage and volume snapshot locations, defined during installation, can also be modified later using CRDs of kind BackupStorageLocation and VolumeSnapshotLocation.</p><h4>Step:6 Installing the Velero CLI</h4><p>To install the Velero CLI locally:</p><p>For linux:</p><pre>curl -L https://github.com/vmware-tanzu/velero/releases/download/v1.14.1/velero-v1.14.1-linux-amd64.tar.gz -o velero.tar.gz<br>tar -zxvf velero.tar.gz<br>sudo mv velero-v1.14.1-linux-amd64/velero /usr/local/bin/</pre><p>For macOS:</p><pre>brew install velero</pre><p>Verify the installation by checking the velero version:</p><pre>velero version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*624lQgtVDh0sG1dF" /></figure><h4>Step:7 Performing a Cluster Backup using Velero</h4><p>To test this setup, we will first deploy a sample application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VWwnbete-vPQg5PK" /></figure><p>To initiate a full cluster backup, execute the following command from your local machine using the Velero CLI:</p><pre># Change the backup name as needed<br># Example: velero backup create &lt;your-backup-name&gt;<br><br>velero backup create backup1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2SFTJIQkPw-FQgy5Zz5jQ.png" /></figure><p>We can describe the backup to view its details by running the following command:</p><pre>velero backup describe backup1 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yyRu0SQdf8dmIcvi4dhFCg.png" /></figure><p>By default, a Velero backup remains valid for 30 days. However, this can be customized using the — default-backup-ttl flag during backup creation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X2BXw9dHphUEo5RD" /></figure><p>To inspect other backed-up objects, you can check the S3 storage where the backups are stored. This step ensures that both the cluster’s object data and volume snapshots have been successfully backed up.</p><h4>Step:8 Performing a Cluster Restoration using Velero</h4><p>To restore a cluster using Velero, ensure that Velero is installed on the target cluster. When initiating a restoration from a previous backup, if the data is already in the cluster the process will skip that part. For restoring to a different cluster, it is essential to match the API server version with the source cluster to ensure compatibility.</p><p>Connect to your target cluster and use the following command to restore the cluster form backup:</p><pre># change the restoration name as needed<br># Example: velero restore create &lt;your-restore-name&gt; --from-backup &lt;your-backup-name&gt;<br><br>velero restore create restore1 --from-backup backup1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R2I96_btZKByoIAh" /></figure><p>This command will initiate a full cluster restoration. Additionally, Velero provides the capability to migrate the entire cluster to a different region if needed.</p><p>After executing the restoration command, the following output shows all the backed up resources such as pods, services, persistent volume and persistent volume claim, were successfully recovered in this cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4XXwlO-72K4bc1WK" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9090c3ba619" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/eks-backups-made-easy-with-velero-for-disaster-recovery-c9090c3ba619">EKS Backups made easy with Velero for Disaster Recovery</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>