<?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>Forem: Selvamraju007</title>
    <description>The latest articles on Forem by Selvamraju007 (@selvamraju007).</description>
    <link>https://forem.com/selvamraju007</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%2F1025833%2F34166f25-e94c-48d3-b1b9-8f0e4426dd71.png</url>
      <title>Forem: Selvamraju007</title>
      <link>https://forem.com/selvamraju007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/selvamraju007"/>
    <language>en</language>
    <item>
      <title>Connect GCP VM Instances with VS Code on Windows 10</title>
      <dc:creator>Selvamraju007</dc:creator>
      <pubDate>Mon, 22 May 2023 13:24:32 +0000</pubDate>
      <link>https://forem.com/kcdchennai/connect-gcp-vm-instances-with-vs-code-on-windows-10-akl</link>
      <guid>https://forem.com/kcdchennai/connect-gcp-vm-instances-with-vs-code-on-windows-10-akl</guid>
      <description>&lt;p&gt;In this blog we are going to see how connect GCP VMs with VS Code on Windows 10 machine.&lt;/p&gt;

&lt;p&gt;Please refer the below step by step for your reference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install google cloud cli on your local machine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install cloud SDLK using the &lt;a href="https://cloud.google.com/sdk/docs/install"&gt;https://cloud.google.com/sdk/docs/install&lt;/a&gt;. I’ve installed via PowerShell command on my local windows machine, you can choose installation method based on your OS.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Step 2: Open Cloud SDK and login using below command&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;And login with your GCP’s account&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Step 3: Open PowerShell and execute below command to create SSH key&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -f [KEY_FILENAME] -C [USERNAME]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;[KEY_FILENAME] is the name of SSH key file that will be created&lt;/li&gt;
&lt;li&gt;[USERNAME] is the username that will use to log in that VM
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -f keyfile -C mytest@gmail.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;This command will create private and public key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Login GCP console and navigate VM which is created already&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go to Compute Engine-&amp;gt; Click VM instances tab-&amp;gt; Click VM name&lt;/p&gt;

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

&lt;p&gt;Click Edit and find SSH Key option save your public key which is created earlier.&lt;/p&gt;

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

&lt;p&gt;Click + ADD ITEM and save your public key&lt;/p&gt;

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

&lt;p&gt;Save and now ready to connect using VS code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Connect with VS code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install Remote - SSH extension&lt;/p&gt;

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

&lt;p&gt;Now click Remote— SSH and Press “+”&lt;/p&gt;

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

&lt;p&gt;Enter the below command to create connection&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i C:\\Users\\[YourUser]\\[KEY_FILENAME] [USERNAME]@[VM's IP]
[VM’s IP]- Use external IP of your VM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now click the IP address to establish connection.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Now successfully connected GCP VM’s with VS code on windows 10 machine. Hope this helps !&lt;/p&gt;

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

</description>
    </item>
    <item>
      <title>Install Linux on Windows with WSL</title>
      <dc:creator>Selvamraju007</dc:creator>
      <pubDate>Fri, 19 May 2023 13:53:55 +0000</pubDate>
      <link>https://forem.com/kcdchennai/install-linux-on-windows-with-wsl-8fi</link>
      <guid>https://forem.com/kcdchennai/install-linux-on-windows-with-wsl-8fi</guid>
      <description>&lt;p&gt;In this blog, we are going to learn how to install Linux on Windows with WSL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WSL&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 to use the commands below.&lt;/p&gt;

&lt;p&gt;Install WSL command:&lt;br&gt;
You can now install everything you need to run WSL with a single command. Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting “Run as administrator”, enter the wsl — install command, then restart your machine.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux.&lt;/p&gt;

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

&lt;p&gt;If you’re running an older build, or just prefer not to use the install command and would like step-by-step directions, see WSL manual installation steps for older versions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change the default Linux distribution installed&lt;/strong&gt;&lt;br&gt;
By default, the installed Linux distribution will be Ubuntu. This can be changed using the -d flag.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;To change the distribution installed, enter: wsl --install -d . Replace  with the name of the distribution you would like to install.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To see a list of available Linux distributions available for download through the online store, enter: wsl --list --online or wsl -l -o.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To install additional Linux distributions after the initial install, you may also use the command: wsl --install -d .&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Basic commands for WSL:&lt;/strong&gt;&lt;br&gt;
The WSL commands below are listed in a format supported by PowerShell or Windows Command Prompt. To run these commands from a Bash / Linux distribution command line, you must replace wsl with wsl.exe. For a full list of commands, run wsl --help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;List available Linux distributions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl --list --online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;List installed Linux distributions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl --list --verbose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See a list of the Linux distributions installed on your Windows machine, including the state (whether the distribution is running or stopped) and the version of WSL running the distribution (WSL 1 or WSL 2). Comparing WSL 1 and WSL 2. This command can also be entered as: wsl -l -v. Additional options that can be used with the list command include: --all to list all distributions, --running to list only distributions that are currently running, or --quiet to only show distribution names.&lt;/p&gt;

&lt;p&gt;I’ve tried above stpes and working fine for me.&lt;/p&gt;

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

</description>
    </item>
    <item>
      <title>Kubernetes Pod Sizing</title>
      <dc:creator>Selvamraju007</dc:creator>
      <pubDate>Wed, 17 May 2023 12:26:25 +0000</pubDate>
      <link>https://forem.com/kcdchennai/kubernetes-pod-sizing-2b5m</link>
      <guid>https://forem.com/kcdchennai/kubernetes-pod-sizing-2b5m</guid>
      <description>&lt;p&gt;Kubernetes has become the de-facto standard for container orchestration and is used extensively in the modern DevOps landscape. When deploying applications to Kubernetes, one of the key considerations is the sizing of the Kubernetes pods.&lt;/p&gt;

&lt;p&gt;A Kubernetes pod is the smallest deployable unit in Kubernetes and is composed of one or more containers that share the same network namespace and storage volumes. The pod is designed to run a single instance of a container, and it is responsible for managing the container’s lifecycle, such as starting, stopping, and restarting the container.&lt;/p&gt;

&lt;p&gt;When sizing a Kubernetes pod, there are several factors to consider, including the amount of CPU and memory required by the container, the number of containers in the pod, and the amount of storage required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPU Sizing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CPU sizing is one of the critical factors to consider when sizing a Kubernetes pod. Kubernetes allocates CPU resources to each pod, and the amount of CPU allocated to a pod determines how much processing power the pod has available.&lt;/p&gt;

&lt;p&gt;When sizing CPU resources for a pod, you should consider the amount of CPU required by the container to run effectively. You can specify the CPU resource requests and limits for the container in the pod specification. The requests are the minimum amount of CPU required by the container, while the limits are the maximum amount of CPU that the container can use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory Sizing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Memory sizing is another critical factor to consider when sizing a Kubernetes pod. Memory allocation in Kubernetes is similar to CPU allocation, and the amount of memory allocated to a pod determines how much memory the pod has available.&lt;/p&gt;

&lt;p&gt;When sizing memory resources for a pod, you should consider the amount of memory required by the container to run effectively. You can specify the memory resource requests and limits for the container in the pod specification. The requests are the minimum amount of memory required by the container, while the limits are the maximum amount of memory that the container can use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Number of Containers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The number of containers in a Kubernetes pod is another factor to consider when sizing a pod. When you add multiple containers to a pod, you need to ensure that each container has enough CPU and memory resources to run effectively. You should also consider the inter-container communication requirements when sizing a pod with multiple containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Storage Sizing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Storage is another critical factor to consider when sizing a Kubernetes pod. The amount of storage required by a container depends on the nature of the application being deployed. You can specify the storage requirements for the container in the pod specification, including the type of storage, the amount of storage, and the storage class to use.&lt;/p&gt;

&lt;p&gt;Here are some examples of Kubernetes pod sizing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Web Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you want to deploy a web application to Kubernetes using a pod. The application requires 2 CPU cores and 4GB of memory to run effectively. In this case, you would specify a CPU request of 2 cores and a memory request of 4GB in the pod specification. You may also specify higher CPU and memory limits if needed. If the application requires persistent storage, you would also specify the storage requirements in the pod specification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
  name: web-app-pod
spec:
  containers:
  - name: web-app-container
    image: web-app-image
    resources:
      requests:
        cpu: "2"
        memory: "4Gi"
      limits:
        cpu: "4"
        memory: "8Gi"
    volumeMounts:
    - name: data-volume
      mountPath: /data
  volumes:
  - name: data-volume
    persistentVolumeClaim:
      claimName: data-pvc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2: Microservices Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you have a microservices architecture where each microservice runs in its own container within a Kubernetes pod. Each microservice requires 0.5 CPU cores and 1GB of memory to run effectively. If you have 10 microservices, you would need a pod with a CPU request of 5 cores and a memory request of 10GB. You would also need to ensure that the inter-container communication between the microservices is efficient.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
  name: microservices-pod
spec:
  containers:
  - name: microservice-1
    image: microservice-1-image
    resources:
      requests:
        cpu: "500m"
        memory: "1Gi"
  - name: microservice-2
    image: microservice-2-image
    resources:
      requests:
        cpu: "500m"
        memory: "1Gi"
  # Add more microservices containers as needed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 3: Machine Learning Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you want to deploy a machine learning application to Kubernetes using a pod. The application requires 8 CPU cores and 16GB of memory to run effectively. You would specify a CPU request of 8 cores and a memory request of 16GB in the pod specification. If the application requires GPU resources, you would also need to specify the GPU resource requirements in the pod specification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
  name: ml-app-pod
spec:
  containers:
  - name: ml-app-container
    image: ml-app-image
    resources:
      requests:
        cpu: "8"
        memory: "16Gi"
      limits:
        cpu: "16"
        memory: "32Gi"
    volumeMounts:
    - name: data-volume
      mountPath: /data
    # Add GPU resources if needed
  volumes:
  - name: data-volume
    persistentVolumeClaim:
      claimName: data-pvc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 4: Stateful Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you have a stateful application that requires persistent storage and runs in a single container within a Kubernetes pod. The container requires 1 CPU core and 2GB of memory to run effectively, and the application requires 100GB of persistent storage. In this case, you would specify a CPU request of 1 core, a memory request of 2GB, and a persistent storage request of 100GB in the pod specification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
  name: stateful-app-pod
spec:
  containers:
  - name: stateful-app-container
    image: stateful-app-image
    resources:
      requests:
        cpu: "1"
        memory: "2Gi"
    volumeMounts:
    - name: data-volume
      mountPath: /data
  volumes:
  - name: data-volume
    persistentVolumeClaim:
      claimName: data-pvc
      # Specify the size of the persistent volume
      resources:
        requests:
          storage: 100Gi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are just a few examples of Kubernetes pod sizing. The actual resource requirements for your applications may vary depending on the nature of the application, the workload, and the expected usage patterns. It is essential to monitor the pod’s resource utilization and adjust the pod sizing as needed to ensure optimal performance and prevent resource starvation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sizing a Kubernetes pod involves careful consideration of several factors, including CPU and memory requirements, the number of containers, and storage requirements. By considering these factors, you can ensure that your Kubernetes pods are sized appropriately for the applications they host. Remember to monitor your pods’ resource utilization and adjust your sizing as necessary to optimize performance and prevent resource starvation.&lt;/p&gt;

&lt;p&gt;Thanks for reading the article, hope this helps !&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Kubernetes Logging Best Practices</title>
      <dc:creator>Selvamraju007</dc:creator>
      <pubDate>Tue, 16 May 2023 12:09:42 +0000</pubDate>
      <link>https://forem.com/kcdchennai/kubernetes-logging-best-practices-45ec</link>
      <guid>https://forem.com/kcdchennai/kubernetes-logging-best-practices-45ec</guid>
      <description>&lt;p&gt;Kubernetes is a popular open-source platform for container orchestration that is widely used by developers and DevOps teams for deploying and managing containerized applications. One critical aspect of running any application on Kubernetes is logging, which helps to monitor the health and performance of the application and troubleshoot issues quickly.&lt;/p&gt;

&lt;p&gt;In this blog, we will discuss Kubernetes logging and the best practices for logging in a Kubernetes environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Kubernetes Logging?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes logging refers to the process of capturing and storing log data generated by the Kubernetes cluster and the applications running on it. This data includes information about application performance, errors, warnings, and other events. Kubernetes logs are critical for debugging and troubleshooting issues in a distributed system and are used by developers, operators, and security teams to monitor and maintain application health.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does Kubernetes Logging work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes logs are generated by various components of the Kubernetes cluster, including the Kubernetes API server, kubelet, container runtime, and the applications running on the cluster. These logs are collected and aggregated by a logging agent that runs as a Kubernetes pod and sends them to a central location for storage and analysis.&lt;/p&gt;

&lt;p&gt;The most common logging agent used in Kubernetes is Fluentd, which is an open-source data collector that can collect, transform, and forward log data to various destinations, including Elasticsearch, Splunk, and Kafka. Other popular logging agents include Logstash and Fluent Bit.&lt;/p&gt;

&lt;p&gt;Here is the diagram for how logging using Fluentd works.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Best Practices for Kubernetes Logging:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are some best practices for logging in a Kubernetes environment:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use a centralized logging solution — A centralized logging solution allows you to store and analyze logs in a central location, making it easier to troubleshoot issues and monitor application performance. Elasticsearch, Splunk, and Loggly are some popular centralized logging solutions used with Kubernetes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement log rotation — Log rotation is the process of deleting or archiving old logs to prevent disk space from filling up. It is essential to configure log rotation for your Kubernetes logs to avoid running out of disk space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use structured logging — Structured logging formats log messages in a structured way, making it easier to search, filter, and analyze log data. Use JSON or other structured logging formats instead of plain text to make it easier to extract information from logs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid logging sensitive information — Avoid logging sensitive information such as passwords, API keys, and other credentials in your Kubernetes logs. Instead, use environment variables or secrets to store this information securely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Include contextual information — Including contextual information such as timestamps, hostnames, and request IDs in your logs makes it easier to correlate log events and troubleshoot issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tagging privacy information:&lt;br&gt;
To ensure the security and privacy of sensitive data, it is advisable to tag or mask any sensitive information present in your logs. You can use a standardized format like "priv" or "****" to identify and mask sensitive data such as passwords, credit card numbers, or personally identifiable information (PII).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using different log levels:&lt;br&gt;
Utilizing different log levels allows you to categorize log messages based on their severity or importance. Common log levels include DEBUG, INFO, WARNING, ERROR, and CRITICAL. By using appropriate log levels, you can filter and prioritize log messages based on their significance during troubleshooting and debugging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Streaming logs to a log server:&lt;br&gt;
Rather than relying solely on local log files, it is recommended to stream logs to a centralized log server or a log management system. This ensures that logs are collected and stored centrally, making it easier to search, analyze, and retain logs for longer periods. Popular log servers and management systems include Elasticsearch, Splunk, and Graylog.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enabling log rotation:&lt;br&gt;
Configure log rotation to prevent log files from growing indefinitely and consuming excessive disk space. By setting log rotation parameters, you can control log file size, number of log files to retain, and frequency of rotation. This practice ensures that logs are managed efficiently and prevents disk space issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While &lt;code&gt;kubectl logs&lt;/code&gt; is the standard command for retrieving logs in Kubernetes, there are also several open-source CLI tools available that provide additional features and enhanced log collection capabilities. One such tool is &lt;code&gt;kubetail&lt;/code&gt;, which allows you to tail logs from multiple pods simultaneously. Here are a few open-source CLI tools that you can use for log collection in Kubernetes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Kubetail:&lt;br&gt;
Kubetail is a simple utility that enables you to tail logs from multiple pods within a Kubernetes cluster. It aggregates logs from multiple pods and streams them to your terminal, allowing you to view real-time logs from various sources at once. Kubetail is particularly useful when troubleshooting distributed systems or monitoring application behavior across multiple pods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stern:&lt;br&gt;
Stern is another powerful log tailing tool specifically designed for Kubernetes. It allows you to tail logs from multiple pods and containers within a Kubernetes cluster, providing color-coded output for easy identification. Stern also supports regex-based filtering, making it convenient to focus on specific log messages or patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kail:&lt;br&gt;
Kail is a CLI tool that enables log streaming and tailing from multiple pods in a Kubernetes cluster. It supports log output in both raw and JSON formats, making it flexible for different use cases. Kail also provides options for filtering logs based on labels or namespaces, allowing you to narrow down log output as needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logcli:&lt;br&gt;
Logcli is part of the Loki ecosystem and provides a command-line interface to query logs stored in Loki, a horizontally scalable log aggregation system. It allows you to search and retrieve logs based on various parameters, including labels, time ranges, and log levels. Logcli is useful when you have a centralized logging solution based on Loki and want to query and analyze logs efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These open-source CLI tools provide additional functionality and flexibility for log collection and analysis in Kubernetes. Depending on your specific requirements, you can choose the tool that best fits your needs and integrates well with your existing logging infrastructure.&lt;/p&gt;

&lt;p&gt;Please note that when using any third-party tools, ensure that they are from trusted sources and review their documentation for installation and usage instructions.&lt;/p&gt;

&lt;p&gt;There are various commands that you can use to check logs in a Kubernetes environment. Here is a list of commands that you can use with &lt;strong&gt;kubetail&lt;/strong&gt; to check Kubernetes logs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To tail logs from a specific pod:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &amp;lt;pod-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will stream and display logs from the specified pod. You can include multiple pod names to tail logs from multiple pods simultaneously.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To tail logs from pods matching a label selector:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-l&lt;/span&gt; &amp;lt;label-selector&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will stream and display logs from all the pods that match the specified label selector.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To tail logs from pods in a specific namespace:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-n&lt;/span&gt; &amp;lt;namespace&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will stream and display logs from all the pods in the specified namespace.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To tail logs from multiple pods using wildcard expressions:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &amp;lt;pod-name-1&amp;gt; &amp;lt;pod-name-2&amp;gt; ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command allows you to specify multiple pod names or use wildcard expressions to tail logs from multiple pods. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail my-app-&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will tail logs from all pods that start with "my-app-".&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To include timestamps in log output:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-t&lt;/span&gt; &amp;lt;pod-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will display logs with timestamps, allowing you to see when log messages were generated.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To stop tailing logs from a specific pod:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;--stop&lt;/span&gt; &amp;lt;pod-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will stop streaming and displaying logs from the specified pod.&lt;/p&gt;

&lt;p&gt;These are some of the common commands you can use with &lt;code&gt;kubetail&lt;/code&gt; to efficiently tail logs from multiple pods in a Kubernetes cluster. Make sure to install and set up &lt;code&gt;kubetail&lt;/code&gt; before using these commands. Refer to the &lt;code&gt;kubetail&lt;/code&gt; documentation for installation instructions and additional features.&lt;/p&gt;

&lt;p&gt;When using &lt;code&gt;kubetail&lt;/code&gt;, you can also view the logs of Kubernetes control plane components by specifying their pod names. Here's how you can view the logs of some commonly used control plane components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To view the logs of the Kubernetes API server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system kube-apiserver-&amp;lt;node-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;&amp;lt;node-name&amp;gt;&lt;/code&gt; with the actual name of the node where the API server pod is running. This command will tail the logs of the API server.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To view the logs of the Kubernetes controller manager:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system kube-controller-manager-&amp;lt;node-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;&amp;lt;node-name&amp;gt;&lt;/code&gt; with the name of the node where the controller manager pod is running. This command will tail the logs of the controller manager.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To view the logs of the Kubernetes scheduler:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system kube-scheduler-&amp;lt;node-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;&amp;lt;node-name&amp;gt;&lt;/code&gt; with the name of the node where the scheduler pod is running. This command will tail the logs of the scheduler.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To view the logs of the etcd cluster:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubetail &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system etcd-&amp;lt;node-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;&amp;lt;node-name&amp;gt;&lt;/code&gt; with the name of the node where the etcd pod is running. This command will tail the logs of the etcd cluster.&lt;/p&gt;

&lt;p&gt;Remember to replace &lt;code&gt;&amp;lt;node-name&amp;gt;&lt;/code&gt; with the actual node name where the respective control plane component pod is running. The &lt;code&gt;-n kube-system&lt;/code&gt; flag is used to specify the namespace where the control plane components are typically deployed.&lt;/p&gt;

&lt;p&gt;By tailing the logs of these control plane components, you can monitor their activity, detect any issues or errors, and gain insights into the behavior of your Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes logging is a critical aspect of running applications on Kubernetes. A centralized logging solution, log rotation, structured logging, avoiding sensitive information, and including contextual information are some best practices for logging in a Kubernetes environment. By following these best practices, you can ensure that your Kubernetes logs are stored securely, easy to search and analyze, and help you troubleshoot issues quickly.&lt;/p&gt;

&lt;p&gt;Thanks for reading the article, hope this helps !&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
