<?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 Praveen Kumar Adoni on Medium]]></title>
        <description><![CDATA[Stories by Praveen Kumar Adoni on Medium]]></description>
        <link>https://medium.com/@praveenadoni4456?source=rss-fb96e0141b39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6EJ_2pYpMVEHH4iP</url>
            <title>Stories by Praveen Kumar Adoni on Medium</title>
            <link>https://medium.com/@praveenadoni4456?source=rss-fb96e0141b39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 18:43:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@praveenadoni4456/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[Understanding Docker Volumes: A Comprehensive Guide with Examples | Part 3]]></title>
            <link>https://medium.com/@praveenadoni4456/understanding-docker-volumes-a-comprehensive-guide-with-examples-part-3-684851696695?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/684851696695</guid>
            <category><![CDATA[docker-container]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[volume]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Sun, 17 Mar 2024 08:25:31 GMT</pubDate>
            <atom:updated>2024-03-17T08:58:23.089Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4UTCL7eFnJ_8U-xpBnJ1g.png" /></figure><p>Docker has emerged as a powerhouse, enabling devops/developers to encapsulate their applications and dependencies into isolated environments. Docker volumes play a crucial role in managing data within these containers, offering flexibility, persistence, and ease of use. In this blog post, we’ll delve into Docker volumes, exploring what they are, why they’re important, and how to use them effectively with practical examples.</p><h3>What are Docker Volumes?</h3><p>Docker volumes provide a way to persist data generated and used by Docker containers. Unlike the container’s writable layer, which is ephemeral and gets destroyed when the container stops, volumes exist outside of the container’s lifecycle. This means that data stored in volumes remains intact even when the container is removed.</p><h3>Why Are Docker Volumes Important?</h3><p>1. <strong>Data Persistence</strong>: Volumes ensure that critical data persists across container restarts and updates. This is vital for databases, file storage, and other applications where data integrity is paramount.</p><p>2. <strong>Sharing Data Between Containers</strong>: Volumes facilitate sharing data between multiple containers, enabling collaboration and communication within a Dockerized application.</p><p>3. <strong>Backup and Restore</strong>: With volumes, you can easily back up important data and restore it when needed, enhancing the resilience of your Dockerized applications.</p><h3>Using Docker Volumes: Examples</h3><p>Let’s dive into some practical examples to illustrate the usage of Docker volumes.</p><h3>Example 1: Persistent Data Storage for a Database</h3><p>Suppose you’re running a PostgreSQL database in a Docker container, and you want to ensure that the data persists even if the container is stopped or removed.</p><pre>docker volume create pg_data</pre><pre>docker run -d --name postgres -e POSTGRES_PASSWORD=password -v pg_data:/var/lib/postgresql/data postgres:latest</pre><p>In this example:</p><p>- We create a Docker volume named pg_data using the docker volume create command.</p><p>- We run a PostgreSQL container named postgres, specifying the -v flag to mount the pg_data volume to the container’s /var/lib/postgresql/data directory. This ensures that the database data is stored in the volume.</p><h3>Example 2: Sharing Data Between Containers</h3><p>Let’s say you have an application that consists of two Docker containers: one for the frontend and another for the backend. You need to share a configuration file between these containers.</p><pre>docker run -d --name backend -v config:/app/config backend:latest</pre><pre>docker run -d --name frontend --link backend -v config:/app/config frontend:latest</pre><h3>In this example:</h3><p>- We create a Docker volume named config.</p><p>- We run the backend container and mount the config volume to the /app/config directory.</p><p>- We run the frontend container, linking it to the backend container and mounting the same config volume. This allows both containers to access the shared configuration file.</p><h3>Conclusion</h3><p>Docker volumes are a powerful feature that enhances the flexibility, resilience, and scalability of Dockerized applications. By understanding how to effectively use volumes, you can ensure data persistence, facilitate communication between containers, and streamline your Docker workflows. With the examples provided in this post, you should now feel confident in incorporating Docker volumes into your containerized applications. Happy containerizing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=684851696695" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Docker Images with Multistage Builds: A Beginner’s Guide | Part 2]]></title>
            <link>https://medium.com/@praveenadoni4456/optimizing-docker-images-with-multistage-builds-a-beginners-guide-part-2-c8d6002d83a8?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8d6002d83a8</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Sat, 18 Nov 2023 06:50:33 GMT</pubDate>
            <atom:updated>2023-11-18T11:58:06.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4l9rmmtG0H9EVZlYNaZLQ.png" /></figure><p>While working with Docker, I used to employ a single-stage build, resulting in Docker image sizes around 1GB. I never considered the impact on image size and storage. <a href="https://www.linkedin.com/in/ACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs?miniProfileUrn=urn%3Ali%3Afs_miniProfile%3AACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs">Ashwin Kallaje</a> guided me towards adopting a multi-stage build approach and utilizing Red Hat’s registered open-source image. This not only reduced the size of the images but also proved to be a cost-effective solution. <a href="https://www.linkedin.com/in/ACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs?miniProfileUrn=urn%3Ali%3Afs_miniProfile%3AACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs">Ashwin Kallaje</a> , a Product Solutions Architect, possesses extensive knowledge in this domain.</p><h3>Understanding Multistage Builds:</h3><p>Multistage builds allow developers/devOps to create smaller and more efficient Docker images by separating the build environment from the runtime environment. This technique involves defining multiple “stages” in the Dockerfile, each with its specific purpose.</p><ol><li><strong>Build Stage: </strong>In the initial stage, you can use a full-featured image with all the necessary build tools and dependencies to compile and package your application.This stage focuses on generating artifacts and binaries needed for your application.</li><li><strong>Runtime Stage: </strong>The second stage, often referred to as the runtime stage, starts with a minimal base image. Only the essential files and artifacts generated in the build stage are copied into this stage. The result is a smaller, more efficient image that contains only what is required to run the application.</li></ol><h3>Benefits of Multistage Builds:</h3><ol><li><strong>Reduced Image Size: </strong>By separating the build environment from the runtime environment, the final image only includes the necessary files and libraries.This results in significantly smaller Docker images, which leads to faster deployment times and reduced storage requirements.</li><li><strong>Improved Security: </strong>The build stage may involve installing additional packages and dependencies needed for compilation, but these are not present in the final runtime stage.This reduces the attack surface and minimizes potential vulnerabilities, enhancing the security posture of your Docker images.</li></ol><h3>Leveraging Red Hat Minimal Image:</h3><p>As part of the multistage build strategy, <a href="https://www.linkedin.com/in/ACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs?miniProfileUrn=urn%3Ali%3Afs_miniProfile%3AACoAAAgvOi0BHvgQIwmnpuCIz3GuVVJSxHUW-Qs">Ashwin</a> recommended incorporating Red Hat’s minimal image in the second stage. Here’s why:</p><p>When selecting a base image for the runtime stage, the choice of the base image is critical. Red Hat offers minimal base images that are designed for security, stability, and efficiency. Here’s why incorporating Red Hat’s minimal image into your multistage builds is beneficial:</p><ol><li><strong>Security Assurance: </strong>Red Hat’s minimal images are built and maintained by a dedicated security team.These images come with regular security updates and patches, ensuring that your containers are protected against known vulnerabilities.</li><li><strong>Streamlined Image: </strong>Red Hat’s minimal image provides a slim and efficient foundation for running applications, reducing the attack surface and minimizing the risk of security breaches.</li><li><strong>Vendor Support: </strong>Utilizing Red Hat images means you benefit from the expertise and support of a reputable vendor with a strong focus on enterprise-grade solutions.</li></ol><h3>Example Dockerfile:</h3><pre># Build Stage<br>FROM some-build-image AS builder<br>WORKDIR /app<br>COPY . .<br>RUN ./build-script<br><br># Runtime Stage<br>FROM registry.redhat.io/ubi8/ubi-minimal<br>WORKDIR /app<br>COPY --from=builder /app/output /app<br>CMD [&quot;./my-app&quot;]</pre><p><strong>Explanation:</strong></p><ol><li><strong>Build Stage: </strong>In the build stage, we start with a base image (some-build-image) that contains all the necessary build tools and dependencies required to compile and package the application. The working directory is set to /app, and the entire application code is copied into this stage. The RUN instruction executes the build script (./build-script), generating the artifacts needed for the application.</li><li><strong>Runtime Stage: </strong>The runtime stage begins with a minimal base image from Red Hat (registry.redhat.io/ubi8/ubi-minimal). This image is specifically designed for running applications in a secure and efficient manner.The working directory is set to /app to maintain consistency with the build stage. Using the COPY --from=builder instruction, we copy only the necessary files from the build stage (located at /app/output) into the runtime stage. This ensures that only the compiled artifacts are included in the final image. The CMD instruction specifies the default command to run when the container starts (./my-app in this case).</li></ol><h3>Conclusion:</h3><p>Incorporating multistage builds with Red Hat’s minimal base image is a powerful strategy for optimizing Docker images. This approach not only results in smaller and more secure containers but also aligns with best practices for containerized application development and deployment. As containerization continues to play a pivotal role in modern software development, adopting these techniques can significantly improve your workflow and infrastructure efficiency.</p><p>By implementing these best practices, developers can ensure that their Docker images are not only lean and efficient but also adhere to high-security standards, contributing to a robust and reliable containerized application environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8d6002d83a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write a Dockerfile: A Beginner’s Guide | Part 1]]></title>
            <link>https://medium.com/@praveenadoni4456/how-to-write-a-dockerfile-a-beginners-guide-part-1-49a495219e5b?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/49a495219e5b</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[praveen-kumar-adoni]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Wed, 01 Nov 2023 10:58:10 GMT</pubDate>
            <atom:updated>2023-11-01T11:21:56.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSbOjVPen4f77LG1NFJafg.png" /></figure><p>Introduction</p><p>Docker has revolutionized the way we develop, deploy, and manage applications. It provides a platform for packaging, distributing, and running applications within isolated containers. In this blog, we’ll explore Docker and Dockerfile, focusing on how to containerize a Java application. By the end of this article, you’ll have a clear understanding of the fundamental concepts and practical examples.</p><p><strong>What is Docker?</strong></p><p>Docker is an open-source platform that automates the deployment of applications inside lightweight, portable containers. Containers are isolated environments that include everything required to run an application, such as code, runtime, libraries, and system tools. Docker simplifies application deployment and scaling, making it a popular choice for DevOps and development teams.</p><p><strong>Dockerfile: Blueprint for Docker Containers</strong></p><p>A Dockerfile is a text file that contains instructions for building a Docker container image. It specifies a base image, adds application code, sets environment variables, and configures the container’s behavior. Let’s create a Dockerfile for a simple Java application.</p><p><strong>Example: Containerizing/Dockerizing a Java Application</strong></p><p>Suppose you have a basic Java application with the following structure:</p><pre>my-java-app/<br>  └── src/<br>  |   └── Main.java<br>  └── Dockerfile</pre><p>1. Create a Dockerfile</p><p>Open a text editor and create a file named Dockerfile within your project directory. This is the starting point for containerization.</p><p>Note: Dockerfile doesn’t have any file extension</p><pre># Use the official OpenJDK base image<br>FROM openjdk:11</pre><pre># Set the working directory<br>WORKDIR /app</pre><pre># This will run and build jar with all dependencies  <br>RUN mvn install</pre><pre># Copy the application JAR file into the container<br>COPY target/my-java-app.jar /app</pre><pre># Specify the command to run when the container starts<br>CMD [&quot;java&quot;, &quot;-jar&quot;, &quot;my-java-app.jar&quot;]</pre><p>Let’s break down the Dockerfile:</p><p>- FROM openjdk:11: This line specifies the base image as OpenJDK 11, which is suitable for a Java application.</p><p>- WORKDIR /app: Sets the working directory inside the container to /app.</p><p>- RUN mvn install: This will run and build jar file with all dependencies which is used to help run the application.</p><p>- COPY target/my-java-app.jar /app: Copies the application JAR file into the container’s /app directory.</p><p>- CMD [“java”, “-jar”, “my-java-app.jar”]: Defines the command to execute when the container starts, running your Java application.</p><p>2. Build the Docker Image</p><p>Now that you have a Dockerfile, you can use it to build a Docker image. Open a terminal and navigate to your project directory. Run the following command:</p><pre># This command will build the docker image<br>docker build -t my-java-app .</pre><p>This command instructs Docker to build an image named my-java-app using the current directory (denoted by .) as the build context.</p><p>3. Run the Docker Container</p><p>Once the image is built, you can run a Docker container based on it. Use the following command:</p><pre># docker run -p host_port:container_port image_name<br>docker run -p 7000:7000 my-java-app</pre><p>The -p publish option is essential when you want to make services inside containers accessible to the outside world or when you&#39;re working with multiple containers that need to communicate over specific ports.</p><p>host_port is the port number on the host machine to which you want to map the container&#39;s port.</p><p>container_port is the port number on the container where the service/application is listening.</p><p>Congratulations! You’ve successfully containerized your Java application. Docker handles the creation and execution of the container, ensuring that it runs consistently across different environments.</p><p><strong>Conclusion:</strong></p><p>Docker and Dockerfile are powerful tools for containerizing applications, making it easier to develop, test, and deploy your software. In this blog, we’ve covered the basics of Docker and created a Dockerfile for a simple Java application. With this knowledge, you can start containerizing your own applications and take full advantage of the benefits Docker offers in terms of portability, scalability, and consistency.</p><p>Containerization is a fundamental skill for modern software development, and learning Docker is a significant step toward mastering it. Start experimenting with Docker and discover how it can streamline your development and deployment processes. Happy containerizing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49a495219e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Significance of Docker: Containerization’s Role in Modern Technology]]></title>
            <link>https://medium.com/@praveenadoni4456/unlocking-the-significance-of-docker-containerizations-role-in-modern-technology-a97e4a556b97?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/a97e4a556b97</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 14:05:46 GMT</pubDate>
            <atom:updated>2023-10-24T14:05:46.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*aHxzpJ4-vhuBdRC4XBJ5yw.png" /></figure><p><strong>Introduction</strong></p><p>In the realm of modern software development and deployment, Docker has emerged as a game-changer. It’s not just a buzzword; it’s a revolutionary technology that’s transforming the way we build, ship, and run applications. Docker is more than just a containerization platform; it’s a paradigm shift that is redefining how software development and deployment work. In this blog, we will delve into why Docker is used and its immense importance in the world of technology.</p><p><strong>What is Docker?</strong></p><p>Docker is an open-source platform for developing, shipping, and running applications in containers. Containers are lightweight, standalone, and executable packages that contain everything needed to run a piece of software, including code, runtime, system tools, and libraries. Unlike traditional virtual machines, containers share the same operating system kernel, making them more efficient and faster to deploy.</p><p><strong>Why is Docker Used?</strong></p><p><strong>1. Consistency:</strong> Docker ensures that the application runs consistently across different environments, be it development, testing, or production. This consistency eliminates the “It works on my machine” problem that plagues software development.</p><p><strong>2. Portability:</strong> Containers can run on any system that supports Docker, making it easy to move applications between various environments. This portability is particularly valuable for cloud-native applications.</p><p><strong>3. Isolation:</strong> Containers provide strong isolation between applications. Each container runs in its own environment, preventing conflicts between dependencies and ensuring application stability.</p><p><strong>4. Resource Efficiency:</strong> Containers consume fewer resources than traditional virtual machines because they share the host OS kernel. This efficiency allows for more containers to run on a single server, maximizing resource utilization.</p><p><strong>5. Scaling:</strong> Docker simplifies application scaling. You can quickly scale up or down by launching or stopping containers, making it an ideal choice for microservices architectures.</p><p><strong>6. Version Control:</strong> Docker allows you to version your containers, ensuring that you can always roll back to a previous version if needed. This is a crucial feature for maintaining application reliability.</p><p><strong>7. Simplified DevOps:</strong> Docker has become the cornerstone of DevOps practices. It streamlines the development-to-deployment pipeline, reducing the time between writing code and deploying it into production.</p><p><strong>Importance of Docker</strong></p><p><strong>1. Improved Development Workflow:</strong> Docker simplifies the development process. Developers can create containers with all the necessary dependencies and share them with the team. This consistency streamlines development and minimizes conflicts.</p><p><strong>2. Enhanced Collaboration:</strong> Docker’s portability makes it easy for teams to collaborate. Developers, testers, and operations teams can work on the same container image, ensuring that the application behaves consistently across the development cycle.</p><p><strong>3. Faster Deployment:</strong> Docker enables rapid deployment and scaling. This agility is crucial for meeting the demands of modern applications that require frequent updates and scaling to handle varying workloads.</p><p><strong>4. Cost Efficiency:</strong> Docker’s resource efficiency reduces infrastructure costs. With more containers running on the same hardware, organizations can do more with less.</p><p><strong>5. Microservices Architecture:</strong> Docker plays a pivotal role in the adoption of microservices architecture. Each microservice can be containerized, making it easier to manage, scale, and update individual components of a complex application.</p><p><strong>6. Continuous Integration and Continuous Deployment (CI/CD):</strong> Docker is a linchpin in CI/CD pipelines. It simplifies the process of building, testing, and deploying applications, allowing organizations to release software faster and more reliably.</p><p><strong>7. Infrastructure as Code (IaC):</strong> Docker, in combination with tools like Docker Compose and Kubernetes, facilitates the concept of IaC, where infrastructure can be defined and version-controlled using code, ensuring consistency and reproducibility.</p><p><strong>Conclusion</strong></p><p>Docker has revolutionized the way we build, ship, and run applications. Its consistency, portability, and resource efficiency make it an indispensable tool for modern software development and deployment. The importance of Docker extends beyond simplifying development; it empowers organizations to be more agile, cost-effective, and competitive in a rapidly evolving technological landscape. Whether you are a developer, operations engineer, or business leader, understanding and embracing Docker is essential in today’s digital world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a97e4a556b97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Application Start on Ubuntu with systemd]]></title>
            <link>https://medium.com/@praveenadoni4456/automating-application-startup-on-ubuntu-with-systemd-98be1b3b847c?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/98be1b3b847c</guid>
            <category><![CDATA[systemd]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[application]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Sun, 22 Oct 2023 14:57:48 GMT</pubDate>
            <atom:updated>2023-10-22T14:59:25.768Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*ZReih4QMw1M0bEgv.jpg" /></figure><p>Automating the startup of applications on Ubuntu instances can greatly enhance efficiency and reliability. In this guide, we’ll walk through the steps to create a systemd service that ensures your application starts automatically when the instance boots up.</p><p>what is systemd?</p><p>Systemd is a system and service manager for Linux operating systems. It is a replacement for the traditional System V init (SysV init) system, which has been the standard initialization system for Unix-based operating systems for many years. Systemd provides a more modern and efficient approach to managing system services, daemons, and various aspects of system initialization and management.</p><p>Key features and components of systemd include:</p><ol><li>Service Management: Systemd manages system services, daemons, and other background processes. It can start, stop, restart, and monitor these services.</li><li>Parallel Initialization: Systemd is designed to parallelize the startup process, significantly reducing boot times. It can start services in parallel, taking advantage of modern multi-core processors.</li><li>Dependency Management: Systemd allows you to define and manage dependencies between services, ensuring that services are started in the correct order. This improves system reliability.</li><li>Service Unit Files: Services are defined in configuration files known as service unit files, typically with a .service extension. These files specify how each service should be managed, including the executable to run, command-line arguments, user and group ownership, and more.</li><li>Logging: Systemd includes its own logging system, known as the Journal (systemd-journald), which collects and manages log data from services and system components. The Journal provides centralized and structured logging.</li></ol><p><strong>Prerequisites</strong></p><p>Before we get started, ensure you have the following:</p><p>- Ubuntu instance.<br>- The application you want to automate. For this example, we’ll use a sample application as a placeholder.</p><p><strong>Step 1:</strong> Create a systemd Service File</p><p>1. Log in to your Ubuntu instance via SSH.</p><p>2. Use your preferred text editor (e.g., `nano` or `vim`) to create a systemd service file for your application. We’ll use `nano` in this example:</p><blockquote>sudo nano /etc/systemd/system/my-application.service</blockquote><p>3. In the service file, add the following content:</p><blockquote>[Unit]<br> Description=My Application Auto Start<br> After=network.target</blockquote><blockquote>[Service]<br> ExecStart=/full/path/to/your/application<br> Restart=always<br> User=your_username<br> Group=your_group</blockquote><blockquote>[Install]<br> WantedBy=multi-user.target</blockquote><p>Replace the placeholders with your specific details:</p><p>- `ExecStart`: Replace `/full/path/to/your/application` with the full path to your application’s executable.<br>- `User` and `Group`: Replace these with your Ubuntu instance’s username and group (you can find them using the `whoami` command).</p><p>4. Save the file and exit the text editor.</p><p><strong>Step 2:</strong> Reload systemd and Start the Service</p><p>After creating the systemd service file, reload systemd and start the service:</p><blockquote>sudo systemctl daemon-reload<br>sudo systemctl start my-application.service</blockquote><p><strong>Step 3:</strong> Enable Automatic Startup</p><p>To ensure that your application starts automatically when your Ubuntu instance boots up, enable it:</p><blockquote>sudo systemctl enable my-application.service</blockquote><p><strong>Step 4:</strong> Verify the Service Status</p><p>Check the status of your application service to ensure it’s running without issues:</p><blockquote>sudo systemctl status my-application.service</blockquote><p><strong>Conclusion</strong></p><p>Automating the startup of your applications on a Ubuntu instance using systemd simplifies the process and reduces the need for manual intervention. Whether you’re running web servers, database systems, or custom applications, systemd automation ensures that your services are always up and running.</p><p>With this automation in place, you can focus on your application’s functionality and leave the task of managing the startup to systemd. This not only saves time but also increases the reliability of your infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98be1b3b847c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HostAliase in Kubernetes | Enhancing Kubernetes Networking]]></title>
            <link>https://medium.com/@praveenadoni4456/hostaliase-in-kubernetes-enhancing-kubernetes-networking-48d8c52dc0ec?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/48d8c52dc0ec</guid>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Tue, 03 Oct 2023 05:55:08 GMT</pubDate>
            <atom:updated>2023-10-03T15:20:59.415Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9AGX8AmzCKXQBSyPJWr3g.png" /></figure><p>In the dynamic world of Kubernetes, where containerized applications are hosted and orchestrated, challenges often arise when multiple projects or domains share the same cluster. One common issue faced is latency when communicating between different domains within the same cluster. In such scenarios, optimizing network communication is crucial. In this blog post, we’ll explore how HostAliases can be a powerful solution to overcome latency issues and enhance communication between different domains in a Kubernetes cluster.</p><p>The Latency Challenge</p><p>Imagine a Kubernetes cluster where multiple projects or domains are hosted on the same infrastructure. These domains may have their own microservices, databases, and other services, all communicating within the cluster. However, when services from one domain need to communicate with services in another domain, latency can become a significant bottleneck.</p><p>One of the reasons for this latency is that Kubernetes networking relies on DNS resolution. Each service communicates using service names, which are resolved to IP addresses via DNS. This resolution process can introduce latency, especially when services from different domains need to interact frequently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q4N3MTKX-ZEuUd_HjnOtmA.png" /><figcaption>without host allies, using traditional load balancer and DNS</figcaption></figure><p>Whenever the request made by the user, it will go to load balancer, ingress and then services to pods.</p><blockquote>When we have service inside the same cluster, why can’t we communicate with service directly this is what <strong>HostAliase</strong></blockquote><p>HostAliases in Kubernetes provide a way to map hostnames to IP addresses within a Pod’s network namespace. They effectively allow you to bypass DNS resolution and create direct mappings between hostnames and IP addresses. This feature is especially valuable when optimizing communication between different domains within the same cluster.</p><p><strong>How HostAliases Work?</strong></p><p>HostAliases work by defining custom mappings of hostnames to IP addresses within the Pod’s configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9AGX8AmzCKXQBSyPJWr3g.png" /><figcaption>with hostaliase pod will communicate with in cluster with low latency bypassing load balancer</figcaption></figure><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: example-hostaliase<br>spec:<br>  selector:<br>    matchLabels:<br>      app: example-hostaliase<br>  template:<br>    metadata:<br>      labels:<br>        app: example-hostaliase<br>    spec:<br>      hostAliases:<br>        - hostnames:<br>          - &quot;example-hostaliase.com&quot;<br>          ip: &quot;100.62.223.125&quot; <br>      containers:<br>        - name: example-hostaliase<br>          image: busybox:latest</pre><p>In this example, we’ve created a HostAlias that maps the hostname “example-hostaliase.com” to the IP address “100.62.223.125” within the Pod’s network namespace.</p><p>Benefits of HostAliases for Inter-Domain Communication</p><p>Using HostAliases to optimize communication between different domains within the same Kubernetes cluster offers several benefits:</p><ol><li><strong>Reduced Latency</strong>: By bypassing DNS resolution, HostAliases enable faster communication between services from different domains, reducing latency.</li><li><strong>Predictable Network Performance</strong>: With direct hostname-to-IP mappings, you have more control over network performance, ensuring a consistent and predictable experience.</li><li><strong>Enhanced Isolation</strong>: HostAliases provide a way to maintain isolation between domains while still allowing efficient communication when necessary.</li><li><strong>Improved Debugging</strong>: Troubleshooting and debugging become more straightforward when you can pinpoint hostname-to-IP mappings within your Pod’s configuration.</li></ol><p>Ashwin Kallaje, My Guru an expert Solution Architect, suggests HostAliases as a practical solution to address latency issues when communicating between different domains in the same cluster. By leveraging HostAliases, you can create direct hostname-to-IP mappings, optimizing inter-domain communication and enhancing the overall performance of your Kubernetes applications.</p><p>Conclusion</p><p>In a Kubernetes cluster where multiple projects or domains coexist, optimizing communication between them is crucial to ensure low latency and predictable network performance. HostAliases provide a powerful tool to create custom hostname-to-IP mappings, reducing the latency associated with DNS resolution and improving the overall efficiency of inter-domain communication.</p><p>By following the recommendation of Kubernetes experts like Ashwin Kallaje and incorporating HostAliases into your cluster configurations, you can take significant steps toward enhancing the communication between different domains and achieving better performance and reliability in your Kubernetes environment.</p><p>Reference: <a href="https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/">https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48d8c52dc0ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect to Private sql/psql database from local machine without public IP Address | GCP]]></title>
            <link>https://medium.com/@praveenadoni4456/connect-to-private-sql-psql-database-from-local-machine-without-public-ip-address-gcp-48240f01e592?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/48240f01e592</guid>
            <category><![CDATA[private-ip]]></category>
            <category><![CDATA[psql]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[cloud-proxy]]></category>
            <category><![CDATA[ssh-tunneling]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 11:05:40 GMT</pubDate>
            <atom:updated>2023-09-14T14:26:02.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMQ2cDptj7-RW62S0ynaeg.png" /></figure><p>Private IPs are commonly used for databases instead of public IPs for several important reasons:</p><p>1. <strong>Security:</strong> Public IPs are accessible over the internet, making them more susceptible to unauthorized access, hacking attempts, and security breaches. By using private IPs for databases, you can limit access to only trusted devices within your private network or Virtual Private Cloud (VPC). This reduces the exposure of your database to potential threats.</p><p>2. <strong>Network Isolation:</strong> Private IPs allow you to isolate your database from the public internet. This isolation provides an additional layer of protection against external attacks and ensures that only authorized users and systems within your private network can communicate with the database.</p><p>3. <strong>Compliance:</strong> Many regulatory requirements and security standards, such as HIPAA and PCI DSS, mandate the use of private IPs and network segmentation to protect sensitive data. Using private IPs can help you achieve compliance with these standards.</p><p>4. <strong>Reduced Attack Surface:</strong> By not exposing your database with a public IP, you reduce the attack surface available to potential attackers. This makes it more challenging for them to discover and target your database.</p><p>5. <strong>Enhanced Control:</strong> Private IPs offer greater control over who can access your database. You can configure security groups, network ACLs (Access Control Lists), and other network-level security measures to control inbound and outbound traffic to and from the database.</p><p>6. <strong>Cost Savings:</strong> Public IPs often incur additional costs, especially if they are associated with elastic IPs or other services. Using private IPs for internal communication can help reduce infrastructure costs.</p><p>7. <strong>Performance:</strong> In some cases, using private IPs can result in improved network performance because traffic between your application servers and the database can stay within the same network or data center, reducing latency.</p><p>In summary, the use of private IPs for databases enhances security, compliance, and control, while reducing the attack surface and potential costs associated with public IPs. It is a best practice for securing sensitive data and maintaining the integrity of your network infrastructure.</p><p>Now that we understand the importance of using private IPs for databases, a common concern arises: how can developers connect to the database when it uses a private IP address? While the database and application might run smoothly when they’re on the same network or a peered network, there are strategies to ensure seamless developer access.</p><p><strong>1. VPNs (Virtual Private Networks):</strong> One effective solution is to set up a VPN that allows developers to securely access the private network where the database resides. By connecting to the VPN, developers can effectively extend their local network to include the database server. This approach maintains the security benefits of a private IP while granting authorized access.</p><p><strong>2. Bastion Hosts or Jump Servers:</strong> Another approach is to use a bastion host or jump server. This is a dedicated server with a public IP address that acts as an intermediary between developers and the database. Developers can SSH or RDP into the bastion host, and from there, they can access the database using its private IP. Access to the bastion host should be strictly controlled and authenticated to ensure security.</p><p><strong>3. SSH Tunneling or Port Forwarding:</strong> For databases that support SSH access, developers can create SSH tunnels or use port forwarding to establish a secure connection to the database server. This method encrypts the traffic between the developer’s machine and the database server, making it a secure option for accessing a private IP-based database.</p><p>using private IPs for databases offers significant security advantages. However, it’s essential to implement access methods that balance security with developer convenience. VPNs, bastion hosts, SSH tunneling are some of the strategies you can employ to ensure that developers can access the database securely, even when it uses a private IP address. By implementing these solutions, you can maintain the integrity of your network infrastructure while providing the necessary access to your development team.</p><blockquote><strong>We are going to use</strong> <strong>SSH Tunneling or Port Forwarding, VPNs (Virtual Private Networks) is expensive best cost effective way is using jumphost and SSH Tunneling</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*mIoqLDhRSnMyFZMcHsX-Sg.png" /><figcaption>The above diagram shows how the Cloud SQL Auth Proxy connects to Cloud SQL</figcaption></figure><p>The plan is we are going to connect to cloud sql with jump host VM with cloud proxy, from local machine we are going to create SSH Tunneling/Port Forwarding and connect with pg admin/sql</p><p>Let’s do it:</p><p><strong>Step 1:</strong> Once you create database with private IP and without public IP address</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOUT5F0K56zLh4Var65yOw.png" /></figure><p><strong>Step 2: </strong>Create VM instance(jump host) with minimal resources, the service account which is used for creating VM should have cloud sql editor access/cloud sql client</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j0UqEDfGFhbIQPO6wehH9g.png" /></figure><p><strong>Step 3:</strong> Enable Identity-Aware Proxy(IAP) → SSH and TCP Resources all the status should be ok</p><p><strong>Step 4:</strong> SSH to the Jump host and download sql proxy by running below command</p><blockquote>curl -o cloud-sql-proxy <a href="https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.6.1/cloud-sql-proxy.linux.amd64">https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.6.1/cloud-sql-proxy.linux.amd64</a></blockquote><p><strong>Step 5:</strong> Make the Cloud SQL Auth Proxy executable</p><blockquote>chmod +x cloud-sql-proxy</blockquote><p><strong>Step 6:</strong> lets run proxy and connect database, Replace connection name with actual connection name of your database in below command</p><blockquote>./cloud-sql-proxy — address 0.0.0.0 — port 3307 Connection name — private-ip</blockquote><p>It’s important to note that when you have only a private IP address for your database instance, you may need to specify the --private-ip parameter or a similar configuration option when connecting. Otherwise, the connection may attempt to use a public IP address, which won&#39;t work for private IP-based databases.</p><p>Once you connected you will be seeing “<strong>The proxy has started successfully and is ready for new connections!”</strong></p><p>Great you connected to database, now if you have public IP for jump host you can use it directly opening the port 3307 in fire wall and access from local, here we are using private jump host</p><p><strong>Step 7:</strong> Now we need to run below command for creating secure tunneling by IAP, replace name of instance and zone as per your VM instance</p><blockquote>gcloud compute start-iap-tunnel Name_of_jumphost 3307 — local-host-port=localhost:5432 — zone=zone_of_jumphost_instance</blockquote><p><strong>Step 8:</strong> Open your sql/psql managed application from local connect with you credentials here the host will be 127.0.0.1 port 5432</p><p>Thank you…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48240f01e592" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ERROR: Got permission denied while trying to connect to the Docker daemon socket at…]]></title>
            <link>https://medium.com/@praveenadoni4456/error-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket-at-e68bfab8146a?source=rss-fb96e0141b39------2</link>
            <guid isPermaLink="false">https://medium.com/p/e68bfab8146a</guid>
            <category><![CDATA[permission]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-error]]></category>
            <dc:creator><![CDATA[Praveen Kumar Adoni]]></dc:creator>
            <pubDate>Sat, 12 Aug 2023 13:58:14 GMT</pubDate>
            <atom:updated>2023-08-12T15:20:57.386Z</atom:updated>
            <content:encoded><![CDATA[<h3>ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock</h3><p>Typically occurs when the user or process attempting to interact with Docker doesn’t have the necessary permissions to access the Docker daemon’s Unix socket.</p><p>The Docker daemon socket, usually located at /var/run/docker.sock, is used for communication between the Docker client and the Docker daemon. The Docker daemon manages Docker containers and images, while the Docker client is used to issue commands to the daemon.</p><p>Let’s fix this error ✨</p><p>Follow the steps below</p><p><strong>Step 1:</strong><br>Create docker group if not exist : sudo groupadd docker</p><p><strong>Step 2:</strong><br>Add user to docker group : sudo usermod -aG docker ${USER}</p><p><strong>Step 3:</strong><br>Change docker.sock to new permission : sudo chmod 666 /var/run/docker.sock</p><p><strong>Step 4:</strong><br>Finally restart docker daemon service : sudo systemctl restart docker</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e68bfab8146a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>