<?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 Arjun Yadav on Medium]]></title>
        <description><![CDATA[Stories by Arjun Yadav on Medium]]></description>
        <link>https://medium.com/@arjun.y?source=rss-6aaccc8be253------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6s13Zi4NdTHOG1sW</url>
            <title>Stories by Arjun Yadav on Medium</title>
            <link>https://medium.com/@arjun.y?source=rss-6aaccc8be253------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:33:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arjun.y/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[A Complete Guide to Installing NGINX Ingress Controller on Amazon EKS]]></title>
            <link>https://medium.com/cypik/a-complete-guide-to-installing-nginx-ingress-controller-on-amazon-eks-078211494d3e?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/078211494d3e</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 12:40:35 GMT</pubDate>
            <atom:updated>2026-07-23T12:40:35.521Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Understanding NGINX Ingress Architecture: How Traffic Flows Inside Kubernetes" src="https://cdn-images-1.medium.com/max/1024/1*mm0MAU9iwEhw1I8VnFFcXg.png" /></figure><h3>How nginx ingress controller works ?</h3><ol><li>Ingress Resource Creation: Configure an Ingress resource within your Kubernetes cluster to manage external access. By defining hostnames, routing paths, and backend services, you establish the logic required to direct incoming traffic to your applications.</li><li>Controller Monitoring: The Nginx Ingress Controller maintains a continuous watch on the Kubernetes API server to detect and synchronize real-time updates to Ingress resources.</li><li>Configuration Generation: Upon detecting new or modified Ingress resources, the controller automatically generates an Nginx configuration file based on the specified rules.</li><li>Configuration Update: The controller automatically synchronizes the updated configuration file across all active Nginx pods.</li><li>Nginx functions as a high-performance reverse proxy, intercepting incoming traffic and intelligently routing requests to the appropriate backend services based on defined Ingress rules.</li><li>Load Balancing: Nginx efficiently distributes incoming traffic across multiple service pods, optimizing resource utilization and ensuring high availability.</li></ol><p>Key operational principles of the Nginx Ingress Controller:</p><ol><li>Automated Configuration: It monitors the Kubernetes API server for updates to Ingress resources and dynamically reloads the Nginx configuration to reflect changes</li></ol><ul><li>Continuous Monitoring: The controller tracks the Kubernetes API server for Ingress resource updates, ensuring Nginx configurations remain synchronized with the desired state.</li><li>Dynamic Configuration: Automatically generates Nginx configurations from Ingress rules to provide flexible traffic routing and efficient load balancing.</li></ul><h3>Use an ALB when:</h3><ul><li><strong>You need advanced HTTP/HTTPS routing:</strong> ALBs operate at Layer 7 (Application Layer), allowing you to route traffic based on various HTTP/HTTPS attributes like host headers, path patterns, query parameters, and even HTTP methods. This makes them ideal for microservices architectures where different services may need to be exposed on the same IP address but with distinct paths or hostnames.</li><li><strong>You need features like WebSockets, HTTP/2, or gRPC:</strong> ALBs fully support these protocols, making them suitable for applications requiring these advanced features.</li></ul><h3>Use an NLB when:</h3><ul><li><strong>You need high-performance TCP/UDP load balancing: </strong>They are a great fit for applications requiring extreme throughput and responsiveness, like gaming servers, streaming services, or real-time communication platforms</li><li><strong>You need to preserve client source IP addresses:</strong> NLBs preserve the original client IP address, which can be crucial for applications that need to identify and track individual clients.</li></ul><h3><strong>Step — Install Helm</strong></h3><pre>curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 &gt; get_helm.sh <br><br>chmod 700 get_helm.sh <br><br>./get_helm.sh</pre><h3><strong>Step-01 Create the namespace</strong></h3><pre>kubectl create ns ingress-nginx</pre><p><strong>Step-2 Add the helm ingress repo</strong></p><pre>helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx</pre><p><strong>Step-03 Download the values.yml file below repo</strong></p><pre>https://github.com/kubernetes/ingress-nginx/tree/main/charts/ingress-nginx</pre><p>Edit the values.yml as below</p><p>hostNetwork: true</p><p>ingressClass: nginx</p><p><strong>Step-04 Deploy nginx ingress controller</strong></p><pre>helm install ingress-nginx ingress-nginx/ingress-nginx -f values.yml -n ingress-nginx</pre><p><strong>Step-05 Test with sample nodeport application</strong></p><p>vim sample.yml</p><p>kubectl apply -f sample.yml</p><pre>---<br>  apiVersion: apps/v1<br>  kind: Deployment<br>  metadata:<br>    namespace: default<br>    name: hello-app-deployment<br>    labels:<br>      app: hello-app<br>  spec:<br>    replicas: 2<br>    selector:<br>      matchLabels:<br>        app: hello-app<br>    template:<br>      metadata:<br>        labels:<br>          app: hello-app<br>      spec:<br>        containers:<br>        - name: hello-app<br>          image: gcr.io/google-samples/hello-app:1.0<br>          ports:<br>          - containerPort: 8080<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  namespace: default<br>  name: hello-app-service<br>spec:<br>  type: NodePort<br>  selector:<br>    app: hello-app<br>  ports:<br>    - protocol: TCP<br>      port: 8080<br>---<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  annotations:<br>    kubernetes.io/ingress.class: nginx<br>  name: hello-app<br>  namespace: default<br>spec:<br>  rules:<br>    - host: www.devopsbyexample.io<br>      http:<br>        paths:<br>          - path: /<br>            pathType: Prefix<br>            backend:<br>              service:<br>                name: hello-app-service<br>                port:<br>                  number: 8080</pre><p><strong>Step-06 Test with port 80 application</strong></p><p>deploy.yml</p><p>kubectl apply -f deploy.yml</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: nginx-deployment<br>spec:<br>  replicas: 3<br>  selector:<br>    matchLabels:<br>      app: nginx<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx<br>    spec:<br>      containers:<br>      - name: nginx<br>        image: nginx:latest<br>        ports:<br>        - containerPort: 80<br><br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: nginx-service<br>spec:<br>  selector:<br>    app: nginx<br>  ports:<br>    - protocol: TCP<br>      port: 80<br>      targetPort: 80<br>  type: ClusterIP<br><br>---<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: nginx-ingress<br>  annotations:<br>    kubernetes.io/ingress.class: nginx<br>spec:<br>  rules:<br>    - host: testlk.com  # Replace with your domain<br>      http:<br>        paths:<br>          - path: /<br>            pathType: Prefix<br>            backend:<br>              service:<br>                name: nginx-service<br>                port:<br>                  number: 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4XJylDHGU-uewk9j_ai-g.png" /></figure><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=078211494d3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/a-complete-guide-to-installing-nginx-ingress-controller-on-amazon-eks-078211494d3e">A Complete Guide to Installing NGINX Ingress Controller on Amazon EKS</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon Virtual Private Cloud (Amazon VPC)]]></title>
            <link>https://medium.com/cypik/amazon-virtual-private-cloud-amazon-vpc-f8c78debae90?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8c78debae90</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 11:23:28 GMT</pubDate>
            <atom:updated>2026-07-23T11:23:28.507Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is AWS VPC?</strong></p><ul><li>VPC stands for Virtual Private Cloud.</li><li>A <em>virtual private cloud</em> (VPC) is a virtual network dedicated to your AWS account.</li><li>Amazon Virtual Private Cloud provides a logically isolated area of the AWS cloud where you can launch AWS resources in a virtual network that you define.</li><li>VPC allows the user to select IP address range, create subnets, and configure route tables, network gateways, and security settings, etc</li><li>You can provide multiple layers of security, including security groups and network access control lists, to help control access to Amazon EC2 instances in each subnet.</li></ul><p><strong>How does it work?</strong></p><p>AWS VPC will look familiar to anyone who used running a physical Data Center (DC). However, the DC components you are used to dealing with such as routers, switches, VLANS, etc. it does not explicitly exist in a VPC. They have been abstracted and re-engineered into cloud software.</p><p><strong>Where VPCs live?</strong></p><ul><li>All VPCs are created and exist in one and only one AWS region.</li><li>AWS regions are geographic locations around the world where Amazon data centers are clustered within region.</li><li>Each Amazon account can host multiple VPCs because VPCs are isolated from each other.</li><li>We can multiple VPC in the same region with different CIDR.</li></ul><p><strong>Default and Custom VPCs</strong></p><ul><li>If your account was created, it comes with a default VPC.</li><li>It has a default subnet in each Availability Zone and it is ready for you to use.</li><li>You can launch instances into your default VPC without needing to know anything about Amazon VPC.</li></ul><p>You can also create your own <strong>Custom VPC</strong>, and configure it as you need. This is also known as a <em>nondefault VPC</em>.</p><h3>Architecture of VPC</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*G1gh5XgY6WTl-IpP.png" /></figure><p>VPC comprises various components</p><h3>Internet Gateway:</h3><ul><li>An Internet Gateway (IGW) is a <em>logical connection between an Amazon VPC and the Internet.</em></li><li>It is <em>not </em>a physical device and Only one can be associated with each VPC.</li><li>When we create IGW, it will not be attached to the VPC automatically, we need to explicitly attach it to the VPC.</li><li>If a VPC <em>does not</em> have an Internet Gateway, then the resources in the VPC <em>cannot be accessed from the Internet.</em></li><li>It does <em>not</em> limit the bandwidth of Internet connectivity. (The only limitation on bandwidth is the size of the Amazon EC2 instance, and it applies to all traffic — internal to the VPC and out to the Internet.)</li></ul><p><strong>AWS Router: </strong>Each AWS VPC has a VPC router.</p><p>The primary function of this VPC router is to take all of the route tables defined within that VPC and then direct the traffic flow within that VPC, as well as to subnets outside of the VPC, based on the rules defined within those tables.</p><p><strong>Route Table and how does it work?</strong></p><ul><li>A set of rules, called routes, are used to determine where network traffic is directed.</li><li>A <em>route table</em> is used to determine where network traffic from your subnet or gateway is directed. In simple terms, the route table tells network packets which way they need to go to get to their destination.</li><li>A subnet can only be associated with one route table at a time, but you can associate multiple subnets with the same subnet route table.</li><li>Every route table contains a local route for communication within the VPC. This route is added by default to all route tables.</li></ul><p><strong>Main Route Table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/0*di3xvAjnADR3IkbZ.png" /></figure><ul><li>The first entry is the default entry for local routing in the VPC.</li><li>This entry enables the instances in the VPC to communicate with each other over IPv4.</li><li>The second entry routes all other IPv4 subnet traffic from the private subnet to your network over the virtual Nat gateway (for example, nat-1a2b3c4d)</li><li><strong>The Main route table</strong> automatically comes with your VPC that is used by default for any subnet that isn’t explicitly associated with a routing table.</li></ul><p><strong>Custom Route Table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/0*X3zFCVfUNRXPwHx2.png" /></figure><ul><li><strong>Custom route table </strong>that you create for your VPC.</li><li>The first entry is the default entry for local routing in the VPC.</li><li>This entry enables the instances in the VPC to communicate with each other.</li><li>The second entry routes all other IPv4 subnet traffic from the public subnet to the internet over the internet gateway (for example, igw-1a2b3c4d</li></ul><p>The <strong>Destination</strong> is the pattern for where the packet is trying to end up and the <strong>Target</strong> is where the packet should go. For example, packets with a destination within 10.0.0.0/16 should be routed directly inside the VPC.</p><p>In the above VPC architecture, we have defined public and private route tables so let’s understand it.</p><p><strong>Public Route Table — Routing to Internet Gateway:</strong> The route table which is directly associated with the Internet gateway is called the Public Route table. To make the route table public, we need to add routes destination 0.0.0.0 and Target the Internet Gateway id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/0*Nb0qgpebJw_mIlIt.png" /></figure><p><strong>Private Route Table — Routing to Nat Gateway:</strong> The route table which is directly associated with the Nat gateway is called the Private Route table. To make the route table private, we need to add routes destination 0.0.0.0 and Target the Nat Gateway id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/0*kN_CO9_aQ3rD4EvR.png" /></figure><p><strong>Nat Gateway:</strong></p><ul><li>NAT device enables instances in a private subnet to connect to the Internet or other AWS services but prevents the Internet from initiating connections with the instances.</li><li>NAT gateway always resides inside the public subnet of an Availability Zone.</li><li>Elastic IP must be attached to the NAT gateway while creating.</li><li>NAT devices do not support IPv6 traffic, use an egress-only Internet gateway instead.</li></ul><p><strong>Subnet:</strong></p><ul><li>A <em>subnet</em> is a range of IP addresses in your VPC and it is a logical subdivision of the VPC network.</li><li>The practice of dividing a network into two or more networks is called subnetting.</li><li>AWS provides two types of subnetting one is Public which allows the internet to access the machine and another is private which is hidden from the internet.</li><li>A subnet is a span to a single availability zone.</li></ul><p><strong>Public Subnet:</strong></p><ul><li>A public subnet is a subnet that’s associated with a route table (public route table) that has a route to an internet gateway.</li><li>Resources that reside within the public subnet can access the Internet with an Internet gateway.</li></ul><p><strong>Private Subnet:</strong></p><ul><li>A public subnet is a subnet that’s associated with a route table (private route table) that has a route to a NAT gateway.</li><li>Resources that reside within the private subnet can access the Internet with a NAT gateway.</li><li>The resources from private subnet such as Mysql DB, private VM can’t be accessed directly from the internet.</li><li>We can use VPN as a service from AWS or can a bastion host in the public subnet to connect the resources in the private subnet.</li></ul><h3>VPC Security</h3><p>Security within a VPC is provided through</p><p><strong>Security groups :</strong></p><ul><li>Acts at an Instance level firewall but not at the subnet level.</li><li>Each instance within a subnet can be assigned a different set of Security groups</li><li>allows adding or removing rules (authorizing or revoking access) for both Inbound (ingress) and Outbound (egress) traffic to the instance</li><li><strong>Default</strong> Security Group <strong>allows all outbound traffic</strong></li><li>In the Security group, we can <strong>specify only Allow rules, but not deny rules.</strong></li><li>Security Groups are <strong>Stateful — </strong>If a request is allowed, the response for the request is automatically allowed.</li><li><strong>Default</strong> Security is associated with ENI (network interfaces).</li></ul><p><strong>Network access control lists (ACLs):</strong></p><ul><li>It is a security layer for your VPC which is applied on the subnet level.</li><li>stateless firewall — you need to allow both inbound and outbound traffic.</li><li>It is an optional layer for your VPC and can set up a Network ACL similar to the security group that adds an additional layer of security to your VPC.</li><li>When you create VPC, it creates default Network ACL automatically which includes all inbound and outbound ipv4 traffic.</li><li>You can also create a custom network ACL and associates it with a subnet. By default, a custom Network ACL denies all the inbound and outbound ipv4 traffic until you add rules.</li><li>Act as a firewall for associated subnets, controlling both inbound and outbound traffic at the subnet level</li></ul><p><strong>Flow logs:</strong></p><ul><li>VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in the VPC and can help in monitoring the traffic or troubleshooting any connectivity issues.</li><li>Flow log data is stored using Amazon CloudWatch Logs.</li><li>Flow log can be created for the entire VPC, subnets, or each network interface. If enabled, for the entire VPC or subnet all the network interfaces are monitored</li><li>Flow logs do not capture real-time log streams for network interfaces.</li></ul><h3>IP Addresses</h3><p>Instances launched in the VPC can have Private, Public and Elastic IP address assigned to them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/0*kxaxHdJclDHLLYcW" /></figure><p><strong>Private IP Addresses:</strong></p><ul><li>Private IP addresses are not reachable over the Internet and can be used for communication only between the instances within the VPC</li><li>All instances are assigned a private IP address, within the IP address range of the subnet, to the default network interface</li><li>The private IP address is associated with the network interface for its lifetime, even when the instance is stopped and restarted and is released only when the instance is terminated</li><li>Additional Private IP addresses, known as secondary private IP address, can be assigned to the instances and these can be reassigned from one network interface to another</li></ul><p><strong>Public IP address:</strong></p><ul><li>Public IP addresses are reachable over the Internet and can be used for communication between instances and the Internet.</li><li>The public IP address assigned to the Instance depends if the Public IP Addressing is enabled for the Subnet.</li><li>The public IP address can also be assigned to the Instance by enabling the Public IP addressing during the creation of the instance.</li><li>The public IP address is assigned from the AWS pool of IP addresses and it is not associated with the AWS account and hence is released when the instance is stopped and restarted or terminated.</li></ul><p><strong>Elastic IP address:</strong></p><ul><li>Elastic IP addresses are static, persistent public IP addresses that can be associated and disassociated with the instance, as required.</li><li>The elastic IP address is allocated at a VPC and owned by the account unless released.</li><li>A Network Interface can be assigned either a Public IP or an Elastic IP. If you assign an instance, already having a Public IP, an Elastic IP, the public IP is released.</li><li>Elastic IP addresses can be moved from one instance to another, which can be within the same or different VPC within the same account</li><li>Elastic IP is charged for non-usage i.e. if it is not associated or associated with a stopped instance or an unattached Network Interface</li></ul><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c78debae90" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/amazon-virtual-private-cloud-amazon-vpc-f8c78debae90">Amazon Virtual Private Cloud (Amazon VPC)</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Nginx: The Ultimate Guide from Fundamentals to Production-Ready Deployment ]]></title>
            <link>https://medium.com/cypik/mastering-nginx-the-ultimate-guide-from-fundamentals-to-production-ready-deployment-ae85f0b0a685?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae85f0b0a685</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Fri, 30 May 2025 21:40:06 GMT</pubDate>
            <atom:updated>2026-07-23T11:24:01.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhMz7Qq7A8TkSa_tDlIExg.png" /></figure><h3>Hands-On Lab: Building a Complete Setup</h3><h3>Step 1: Create the Backend Application</h3><p><strong>server.js</strong></p><pre>const express = require(&#39;express&#39;);<br>const app = express();<br>const port = process.env.PORT || 3000;</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; {app.listen(port, () =&gt; {<br> res.json({<br> console.log(`Server running on port ${port}`);<br>}); <br> message: &#39;Hello from Node.js server!&#39;,<br> server: `Server running on port ${port}`,<br> timestamp: new Date().toISOString()<br> });<br>});</pre><p><strong>package.json</strong></p><h3>Step 2: Install Dependencies</h3><pre># Install Node.js (if not already installed)<br># Download from https://nodejs.org/</pre><pre># Install npm packages<br>npm install</pre><h3>Step 3: Dockerize the Application</h3><p><strong>Dockerfile</strong></p><pre>FROM node:16-alpine</pre><pre>WORKDIR /app COPY package*.json ./<br>RUN npm install COPY . . EXPOSE 3000 CMD [&quot;npm&quot;, &quot;start&quot;]</pre><h3>Step 4: Build and Run Multiple Instances</h3><pre># Build the Docker image<br>docker build -t nginx-demo-app .</pre><pre># Run multiple instances on different ports# Check running containers<br>docker run -d -p 3001:3000 --name app1 nginx-demo-app<br>docker ps <br>docker run -d -p 3002:3000 --name app2 nginx-demo-app<br>docker run -d -p 3003:3000 --name app3 nginx-demo-app</pre><h3>Step 5: Docker Compose Setup</h3><p><strong>docker-compose.yml</strong></p><h3>Step 6: Nginx Configuration with SSL</h3><p><strong>nginx.conf</strong></p><pre>http { # HTTP Server (redirect to HTTPS) # HTTPS Server ssl_certificate /etc/ssl/certs/nginx.crt; location / {<br> upstream backend {<br> server {<br> server {<br> ssl_certificate_key /etc/ssl/certs/nginx.key; <br> proxy_pass http://backend;<br> proxy_set_header Host $host;<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> proxy_set_header X-Forwarded-Proto $scheme;<br> }<br> }<br>} <br> listen 443 ssl;<br> server_name localhost; <br> listen 80;<br> server_name localhost;<br> return 301 https://$server_name$request_uri;<br> } <br> server app1:3000;<br> server app2:3000;<br> server app3:3000;<br> }</pre><h3>Step 7: Generate SSL Certificate</h3><pre># Create SSL directory<br>mkdir ssl</pre><pre># Generate self-signed certificate<br>openssl req -x509 -nodes -days 365 -newkey rsa:2048 \<br> -keyout ssl/nginx.key \<br> -out ssl/nginx.crt \<br> -subj &quot;/C=US/ST=State/L=City/O=Organization/CN=localhost&quot;</pre><h3>Step 8: Deploy and Test</h3><pre># Start all services<br>docker-compose up -d</pre><pre># Check status# Test the setup<br>docker-compose ps <br>curl http://localhost # Should redirect to HTTPS<br>curl -k https://localhost # Test HTTPS with load balancing</pre><h3>Architecture Diagrams</h3><h3>1. Basic Nginx Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*gZkBlpd_kwqrsMRrk6vBmA.png" /></figure><h3>2. Nginx as Load Balancer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*zVEPI1-5LGITzJvHGzBAYw.png" /></figure><h3>3. Complete Docker Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*pR_AQ4AN7-bz0qvNMaiEJg.png" /></figure><h3>Key Takeaways</h3><h3>Performance Benefits</h3><ul><li><strong>High Concurrency</strong>: Handles thousands of simultaneous connections</li><li><strong>Low Memory Usage</strong>: Event-driven architecture</li><li><strong>Fast Static Content</strong>: Optimized for serving files</li></ul><h3>Production Considerations</h3><ul><li><strong>Health Checks</strong>: Monitor backend server availability</li><li><strong>SSL/TLS</strong>: Always use HTTPS in production</li><li><strong>Logging</strong>: Configure access and error logs</li><li><strong>Security</strong>: Implement rate limiting and security headers</li></ul><h3>Best Practices</h3><ol><li><strong>Use upstream blocks</strong> for backend server definitions</li><li><strong>Implement proper error handling</strong> with custom error pages</li><li><strong>Configure caching</strong> for static and dynamic content</li><li><strong>Set up monitoring</strong> and alerting</li><li><strong>Regular security updates</strong> and configuration reviews</li></ol><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae85f0b0a685" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/mastering-nginx-the-ultimate-guide-from-fundamentals-to-production-ready-deployment-ae85f0b0a685">Mastering Nginx: The Ultimate Guide from Fundamentals to Production-Ready Deployment 🚀</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Kubernetes Ingress: A Comprehensive Guide]]></title>
            <link>https://medium.com/cypik/understanding-kubernetes-ingress-a-comprehensive-guide-96343fc83a5c?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/96343fc83a5c</guid>
            <category><![CDATA[cypik]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ingress]]></category>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 08:30:32 GMT</pubDate>
            <atom:updated>2024-06-21T08:38:39.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*sVk7poPVRiKv_j9eNJOc3A.png" /></figure><p>Kubernetes services are an essential component of any Kubernetes deployment. They allow you to expose your application to other parts of your cluster and the outside world by providing a stable IP and DNS name. With Kubernetes services, you can easily scale your application, perform load balancing, and even define routing based on a set of rules.</p><p>This blog focuses on Ingress, a Kubernetes tool for managing access to a cluster’s services.</p><h3>What is Kubernetes Ingress?</h3><p>Kubernetes ingress is a powerful tool for managing external access to your Kubernetes services. It acts as a layer between your services and the outside world, providing load balancing, SSL termination, and routing based on your defined rules. With Kubernetes ingress, you can easily expose your services to the internet while maintaining granular control over who has access to them.</p><h3>How Kubernetes Ingress Works</h3><p>The way it works at a high level is that you first deploy what is called an <strong><em>Ingress controller</em></strong>. This controller is the actual <strong><em>engine</em></strong> that executes the rules of the ingress by translating them and routing the traffic accordingly.</p><p>An ingress <strong>controller is</strong> like a load balancer which has some forwarding rules. And these rules are passed to this load balancer through an ingress <strong>object</strong>. Yes, we need both an ingress controller and an ingress resource/object in Kubernetes. Later on, we’ll see why.</p><p>There are a couple of ingress controller implementations out there, but the most popular are <strong>Nginx</strong> and <strong>HAProxy</strong>.</p><p>Now let’s get into the steps of how this works.</p><blockquote>As we mentioned, the first step to enable ingress routing is to install the ingress controller. It is typically deployed as a pod inside the cluster through a deployment or a daemonset object. You can find an example of installing an Nginx ingress controller <a href="https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/?ref=kodekloud.com">here</a>.</blockquote><blockquote>Some ingress controllers also support being deployed outside the cluster, but this requires additional configuration for enabling routing through BGP and BIRD. You can check <a href="https://www.haproxy.com/blog/run-the-haproxy-kubernetes-ingress-controller-outside-of-your-kubernetes-cluster/?ref=kodekloud.com">this</a> article for more information.</blockquote><p>But for now, let’s stick with the traditional example of the inside-cluster deployment.</p><p>After the <strong>controller</strong> has been deployed, it is time to start creating the ingress <strong>resource</strong>. This ingress resource will update the controller with the rules to be applied to the traffic. It is created and configured using a manifest file like any other Kubernetes object.</p><p>Example of an ingress manifest:</p><pre>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: ingress-wildcard-host<br>spec:<br>  rules:<br>  - host: &quot;foo.bar.com&quot;<br>    http:<br>      paths:<br>      - pathType: Prefix<br>        path: &quot;/bar&quot;<br>        backend:<br>          service:<br>            name: service1<br>            port:<br>              number: 80<br>  - host: &quot;*.foo.com&quot;<br>    http:<br>      paths:<br>      - pathType: Prefix<br>        path: &quot;/foo&quot;<br>        backend:<br>          service:<br>            name: service2<br>            port:<br>              number: 80</pre><p>Inside the ingress, we can define:</p><ul><li>The host where the rules are applied, e.g., for “example.com” host or “other-example.org”</li><li>A specific path, e.g., “example.com<strong>/path/to/shop</strong>”</li><li>Whether to use HTTP or HTTPS.</li><li>The service and the port to route the traffic to when it matches these rules.</li></ul><p>Here we want traffic destined to<strong> foo.bar.com/bar<em> </em></strong>to be routed to the service with the name<strong><em> </em>service1 </strong>on<strong> port 80</strong></p><p>So when applying this ingress, if a request hits the ingress controller with destination host <strong>foo.bar.com</strong> and path <strong>/bar</strong>, the controller will forward this traffic to the service running on the cluster with the name <strong>service1</strong> on <strong>port 80</strong>. Then it’s the service that forwards this traffic to the pods behind it, as usual.</p><p>You can see now how much flexibility the ingress rules have. Instead of just relying on an IP and port to load balance the traffic, it can load balance based on content in the HTTP header. We can just create smarter, more advanced load-balancing rules.</p><p>The ingress controller makes it possible to have dozens of services running inside your cluster, and you redirect the traffic to each one using only one external-facing IP.</p><p>But wait! Didn’t we mention previously that the ingress controller pods are deployed inside the cluster? So how does the traffic reach the ingress controller in the first place?</p><p>Well, simply through a <strong>LoadBalancer</strong> service. Read more about how a Loadbalancer does this <a href="https://medium.com/cypik/understanding-kubernetes-services-clusterip-nodeport-and-loadbalancer-56fb857a9e5e">here</a>.</p><p>The idea is that you want to expose your ingress controller itself to the outside network. This way, it can receive external traffic. But this time, the difference is that you only expose a single service through the LoadBalancer, which is the ingress controller service. Then it’s up to this service to route the traffic to other backend services in the cluster.</p><p>And this way, you can use a <strong>single</strong> load balancer IP to forward traffic to all your services. And it’s the responsibility of the ingress controller to decide where to direct traffic. Based on its rules and how the content matches those rules, it will decide which service it should forward requests to.</p><p>So the Path now is:</p><p><strong>Client 🡪 LoadBalancer 🡪 Ingress controller 🡪 Other services 🡪 Pod</strong></p><h3>Deploying an Ingress Controller</h3><p>Assume you have two services running in your cluster. The first service handles traffic for <strong>app.test.com</strong>, and the second service handles traffic for <strong>app.prod.com</strong>. Both services receive traffic on port 8080 to forward it to the pods.</p><h3>Configuring Ingress Controller Rules</h3><p>Now you want to expose these services outside the cluster to allow external clients to reach them. So you are about to configure an ingress.</p><p>First, you deploy an ingress <em>controller</em> into your cluster, which is basically a set of pods as part of a deployment. These pods also have their own cluster service — let’s call it <strong>ingress-service</strong>.</p><p>Now you start creating your ingress <em>object</em>. You add two rules inside this ingress.</p><ul><li>One to forward the traffic destined for <strong>app.test.com </strong>to <strong>service 1</strong> on <strong>port 8080</strong></li><li>One to forward traffic destined for<strong> app.prod.com </strong>to <strong>service 2 </strong>on<strong> port 8080.</strong></li></ul><p>The ingress controller will continuously monitor the cluster for newly created or updated ingress objects. Once it finds an ingress rule, it will configure it on itself and start applying it to the traffic. In our example, the ingress controller will detect the ingress rules created for the <strong>app.test.com</strong> and <strong>app.prod.com</strong> hosts and start applying them.</p><p>So whenever it sees traffic with a destination host <strong>app.test.com,</strong> it will redirect it to <strong>service 1</strong> on <strong>port 8080</strong>. And the same applies to <strong>service 2</strong> with host <strong>app.prod.com</strong>. The remaining part now is that you want your ingress controller itself to be able to receive traffic from external clients to match it against these rules.</p><h3>Configuring a LoadBalancer</h3><p>Now you need to create a LoadBalancer service that receives traffic on <strong>port 80</strong> and forwards it to the <strong>ingress-service</strong>. What happens now is that the cloud provider will provision a new external load balancer with a public IP address. Then it adds a rule to it for forwarding traffic to the<strong> ingress-service</strong>.</p><p><strong>Summary:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*LT6lGKSOA3udVEuDXOxU6Q.png" /></figure><p>When traffic reaches the load balancer at the <strong>&lt;Loadbalancer-IP&gt;:80</strong>, it will be redirected to the <strong>ingress-service</strong>. Next, the ingress controller will check the contents of the traffic and apply a matching rule, if found, and forward it to <strong>service 1</strong> or <strong>service 2</strong>. Finally, this traffic reaches the Pods.</p><p>Enjoy it! That’s It; we are done…</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>My name is Arjun lal Yadav, and I am an experienced Linux enthusiast and DevOps engineer. I am passionate about automating and streamlining development processes, and currently, I work at Cypik as a DevOps Engineer. My area of expertise includes optimizing software delivery pipelines and infrastructure management. I specialize in cloud technologies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96343fc83a5c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/understanding-kubernetes-ingress-a-comprehensive-guide-96343fc83a5c">Understanding Kubernetes Ingress: A Comprehensive Guide</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Kubernetes Services: ClusterIP, NodePort, and LoadBalancer]]></title>
            <link>https://medium.com/cypik/understanding-kubernetes-services-clusterip-nodeport-and-loadbalancer-56fb857a9e5e?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/56fb857a9e5e</guid>
            <category><![CDATA[services]]></category>
            <category><![CDATA[cypik]]></category>
            <category><![CDATA[k8s]]></category>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Mon, 17 Jun 2024 06:09:15 GMT</pubDate>
            <atom:updated>2026-07-23T07:11:42.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*v3G1ZeB7Ip-16kijWMHXEw.png" /></figure><p>It’s important to understand how Services work and which options are available so you can correctly deploy your workloads to your Kubernetes clusters. In this guide, we’ll explain the different Service types and share some simple examples of how to create Services for your apps. Let’s begin!</p><p>We will cover:</p><ol><li>What is a Kubernetes Service?</li><li>Types of Kubernetes Service</li><li>How do Services relate to ingresses?</li><li>A Comprehensive Guide to Implementing and Managing Kubernetes Services</li></ol><h3>What is a Kubernetes service?</h3><p>Kubernetes Services are resources that map network traffic to the Pods in your cluster. You need to create a Service each time you expose a set of Pods over the network, whether within your cluster or externally.</p><p>Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/service">Services</a> are API objects that enable network exposure for one or more cluster Pods. Services are integral to the <a href="https://spacelift.io/blog/kubernetes-networking">Kubernetes networking model</a> and provide important abstractions of lower-level components, which could behave differently between different clouds.</p><p><strong>Note:</strong> The term “service” is often used generically by other tools to refer to an app, workload, or deployment. However, a Kubernetes Service is a specific type of entity that always provides network access to an app or component.</p><h3>Why Services are needed in Kubernetes?</h3><p>Services are necessary because of the distributed architecture of Kubernetes clusters. Apps are routinely deployed as Pods that could have thousands of replicas, spanning hundreds of physical compute Nodes. When a user interacts with your app, their request needs to be routed to any one of the available replicas, regardless of where it’s placed.</p><p>Services sit in front of your Pods to achieve this behavior. All network traffic flows into the Service before being redirected to one of the available Pods. Your other apps can then communicate with the service’s IP address or DNS name to reliably access the Pods you’ve exposed.</p><p>DNS for Services is enabled automatically through the Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service">service discovery</a> system. Each Service is assigned a DNS A or AAAA record in the format &lt;service-name&gt;.&lt;namespace-name&gt;.svc.cluster-domain—a service called demo in the default namespace will be accessible within a cluster.local cluster at demo.default.svc.cluster.local, for example. This enables reliable in-cluster networking without having to lookup service IP addresses.</p><h3>Kubernetes Service types</h3><p>All Kubernetes Services ultimately forward network traffic to a set of Pods they represent. However, several different types of Service exist with their own characteristics and use cases. Here’s how the five currently available options compare.</p><h3>1. ClusterIP Services</h3><p>ClusterIP Services assign an IP address that can be used to reach the Service from within your cluster. This type doesn’t expose the Service externally.</p><p>ClusterIP is the default service type used when you don’t specify an alternative option. It’s the most common kind of service you’ll use as it enables simple internal networking for your workloads.</p><h3>2. NodePort Services</h3><p>NodePort Services are exposed externally through a specified static port binding on each of your Nodes. Hence, you can access the Service by connecting to the port on any of your cluster’s Nodes. NodePort Services are also assigned a cluster IP address that can be used to reach them within the cluster, just like ClusterIP Services.</p><p>Use of NodePort Services is generally unadvisable. They have functional limitations and can lead to security issues:</p><ul><li>Anyone who can connect to the port on your Nodes can access the Service.</li><li>Each port number can only be used by one NodePort Service at a time to prevent conflicts.</li><li>Every Node in your cluster has to listen to the port by default, even if they’re not running a Pod that’s included in the Service.</li><li>No automatic load-balancing: clients are served by the Node they connect to.</li></ul><p>When a NodePort Service is used, it’s generally to facilitate the use of your own load-balancing solution that reroutes traffic from outside the cluster. NodePorts can also be convenient for temporary debugging, development, and troubleshooting scenarios where you need to quickly test different configurations.</p><h3>3. LoadBalancer Services</h3><p>LoadBalancer Services are exposed outside your cluster using an external load balancer resource. This requires a connection to a load balancer provider, typically achieved by integrating your cluster with your cloud environment. Creating a LoadBalancer service will then automatically provision a new load balancer infrastructure component in your cloud account. This functionality is automatically configured when you use a managed Kubernetes service such as Amazon EKS or Google GKE.</p><p>Once you’ve created a LoadBalancer service, you can point your public DNS records to the provisioned load balancer’s IP address. This will then direct traffic to your Kubernetes Service. Therefore, LoadBalancers are the Service type you should normally use when you need an app to be accessible outside Kubernetes.</p><h3>4. ExternalName Services</h3><p>ExternalName Services allow you to conveniently access external resources from within your Kubernetes cluster. Unlike the other Service types, they don’t proxy traffic to your Pods.</p><p>When you create an ExternalName Service, you have to set the spec.externalName manifest field to the external address you want to route to (such as example.com). Kubernetes then adds a CNAME DNS record to your cluster that resolves the Service’s internal address (such as my-external-service.app-namespace.svc.cluster.local) to the external address (example.com). This allows you to easily change the external address in the future, without having to reconfigure the workloads that refer to it.</p><h3>5. Headless Services</h3><p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#headless-services">Headless services</a> are a special type of Service that don’t provide load balancing or a cluster IP address. They’re “headless” because Kubernetes doesn’t automatically proxy any traffic through them. This allows you to use DNS lookups to discover the individual IP addresses of any Pods selected by the Service.</p><p>A headless service is useful when you want to interface with other service discovery systems without <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy">kube-proxy</a> interfering. You can create one by specifically setting a Service’s spec.clusterIP field to the None value.</p><h3>How do Services relate to Ingresses?</h3><p><a href="https://spacelift.io/blog/kubernetes-ingress">Ingresses</a> are another type of Kubernetes networking object. They’re often used in conjunction with Services. Whereas Services manage how networking is managed within your cluster, Ingresses are used to control external access, typically based on HTTP and HTTPS routes.</p><p>Ingresses make it much easier to run multiple apps in one cluster. Ideally, you want to avoid creating a new LoadBalancer service for every app, as your cloud provider will bill you for each load balancer resource you use. Ingresses allow you to work with one LoadBalancer service that reroutes traffic based on HTTP characteristics such as hostname and port. You can direct requests to app.example.com to your web-app Service, for example, while api.example.com targets the backend Service.</p><p>To use Ingresses, you have to run an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress-controllers">Ingress controller</a> inside your cluster. The controller creates a single LoadBalancer service that you direct all your external traffic to. When requests hit that service, the Ingress controller compares their characteristics to the Ingress rules you’ve created. It then forwards the requests to the Service indicated by the matching Ingress object.</p><p><strong>Note:</strong> Ingress is a mature Kubernetes feature, but work is underway to replace it with the <a href="https://kubernetes.io/docs/concepts/services-networking/gateway">Gateway API</a>, a modern evolution that’s more generic and offers improved separation of concerns. Gateway is installable as an optional add-on in Kubernetes v1.24+, but Ingress remains supported for the foreseeable future.</p><h3>Example: How to use a Kubernetes Service</h3><p>The following example demonstrates how to create and test simple ClusterIP, NodePort, and LoadBalancer Services in basic configurations. You can learn more about all the available options in the <a href="https://kubernetes.io/docs/concepts/services-networking/service">Kubernetes documentation</a>.</p><p>For ease of use, we’ll deploy an NGINX web server Pod, but the app you expose could equally be a database, metrics agent, microservice, or any other workload that needs network access. You’ll need Kubectl and an existing Kubernetes cluster to follow along.</p><h3>1. Deploy the sample app</h3><p>First, copy the following Deployment manifest and save it as app.yaml in your working directory:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: nginx<br>  labels:<br>    app: nginx<br>spec:<br>  replicas: 3<br>  selector:<br>    matchLabels:<br>      app: nginx<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx<br>    spec:<br>      containers:<br>      - name: nginx<br>        image: nginx:latest<br>        ports:<br>          - containerPort: 80</pre><p>The manifest deploys three replicas of the nginx:latest container image. In the metadata.labels field, an app: nginx label is applied—this will be referenced by your Services in the following steps. The ports.containerPort field within the Pod spec template is used to indicate that the Pods will be exposing port 80, the default NGINX web server port.</p><p>Use Kubectl to apply the Deployment manifest to your cluster:</p><pre>kubectl apply -f app.yaml<br>deployment.apps/nginx created</pre><p>Wait until all the deployment’s Pod replicas are ready:</p><pre>kubectl get deployments<br>NAME    READY   UP-TO-DATE   AVAILABLE   AGE<br>nginx   3/3     3            3           20s</pre><h3>2. Create a ClusterIP Service</h3><p>Now your NGINX deployment is running, but you don’t have a way to access it. Although you could directly connect to the Pods, this doesn’t load balance and will lead to errors if one of the Pods becomes unhealthy or is replaced. Creating a Service allows you to route traffic between the replicas so you can reliably access the Deployment.</p><p>The following manifest defines a simple ClusterIP service:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: nginx-clusterip<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: nginx<br>  ports:<br>    - port: 8080<br>      targetPort: 80</pre><p>There are a few points to note in the manifest:</p><ul><li>The spec.type field is set to ClusterIP as we’re creating a ClusterIP service.</li><li>The spec.selector field selects the NGINX Pods using the app: nginx label applied in the Deployment’s manifest.</li><li>The spec.ports field specifies that traffic to port 8080 on the Service’s Cluster IP address will be routed to port 80 at your Pods.</li></ul><p>Save the manifest as clusterip.yaml, then add it to your cluster:</p><pre>$ kubectl apply -f clusterip.yaml<br>service/nginx-clusterip created</pre><p>Next, use Kubectl’s get services command to discover the cluster IP address that’s been assigned to the Service:</p><pre>kubectl get services<br>NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE<br>nginx-clusterip   ClusterIP   10.109.128.34   &lt;none&gt;        8080/TCP   10s</pre><p>In this example, the service has the IP address 10.109.128.34. You can now connect to this IP from within your cluster in order to reach your NGINX Deployment, with automatic load balancing between your three Pod replicas.</p><p>To check, use <a href="https://spacelift.io/blog/docker-exec">kubectl exec</a> to curl the IP address from inside one of your NGINX Pods:</p><pre>kubectl exec deployment/nginx -- curl 10.109.128.34:8080<br>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current<br>                                 Dload  Upload   Total   Spent    Left  Speed<br>  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Welcome to nginx!&lt;/title&gt;</pre><p>You got a successful response, proving the Service is working. You can also try connecting using the Service’s DNS name, such as nginx-clusterip.default.svc.cluster.local. Whichever method you use, port 8080 must be specified, as that’s the port the Service is configured to listen on.</p><h3>3. Create a NodePort Service</h3><p>Now, let’s externally expose the Deployment using a NodePort Service. The manifest is similar to a ClusterIP Service — specify type: NodePort instead of type: ClusterIP and use the ports.nodePort field to set the Node port to listen on:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: nginx-nodeport<br>spec:<br>  type: NodePort<br>  selector:<br>    app: nginx<br>  ports:<br>    - port: 80<br>      nodePort: 32000</pre><p>You can omit the nodePort field, in which case the port number given by the port field will be used. The manifest above specifies that Node port 32000 will direct traffic to port 80 at your app: nginx Pods.</p><p>Save the manifest as nodeport.yaml and use Kubectl to apply it:</p><pre>kubectl apply -f nodeport.yaml<br>service/nginx-nodeport created</pre><p>Next, find the IP address of one of your cluster’s Nodes:</p><pre>kubectl get nodes -o wide<br>NAME       STATUS   ROLES           AGE     VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME<br>minikube   Ready    control-plane   5h32m   v1.26.1   192.168.49.2   &lt;none&gt;        Ubuntu 20.04.5 LTS   6.2.0-37-generic   docker://20.10.23</pre><p>In this demo, we’re using a local<a href="https://minikube.sigs.k8s.io/docs"> Minikube</a> cluster with no external IP address available. The internal IP address is resolvable from the host machine, so the following example still works. For Nodes that have an external IP address assigned, such as those provisioned in your cloud accounts, you can access the service using both the internal and external IPs.</p><p>Accessing port 32000 on your Node’s IP address should now connect you to your NGINX deployment:</p><pre>curl 192.168.49.2:32000<br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Welcome to nginx!&lt;/title&gt;</pre><h3>4. Create a LoadBalancer Service</h3><p>The simplest LoadBalancer Service looks very similar to ClusterIP Services:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: nginx-lb<br>spec:<br>  type: LoadBalancer<br>  selector:<br>    app: nginx<br>  ports:<br>    - port: 8080<br>      targetPort: 80</pre><p>Adding this Service to your cluster will attempt to use the configured load balancer integration to provision a new infrastructure component. If you created your cluster from a managed cloud service, this should result in a load balancer resource being added to your cloud account.</p><p>Save the manifest as lb.yaml, then apply it with Kubectl:</p><pre>kubectl apply -f lb.yaml<br>service/nginx-lb created</pre><p>If you are following along using Minikube, start a<a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#example-of-loadbalancer"> minikube tunnel session</a> to expose your load balancer Service before continuing below.</p><p>Run Kubectl’s get services command with the output format set to wide to view the publicly accessible external IP address that’s been assigned to the load balancer:</p><pre>$ kubectl get services -o wide<br>NAME              TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)          AGE     SELECTOR<br>nginx-lb          LoadBalancer   10.96.153.245   10.96.153.245   8080:30226/TCP   79s     app=nginx</pre><p>You can reach the Service by connecting to its external IP address. Note that our demo Service is configured by its ports.port field to listen on port 8080 again, so this is the port you should target.</p><pre>curl 10.96.153.245:8080<br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Welcome to nginx!&lt;/title&gt;</pre><p>Enjoy it! That’s It; we are done…</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56fb857a9e5e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/understanding-kubernetes-services-clusterip-nodeport-and-loadbalancer-56fb857a9e5e">Understanding Kubernetes Services: ClusterIP, NodePort, and LoadBalancer</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up Elasticsearch, Logstash, and Kibana (Elastic Stack) on Ubuntu]]></title>
            <link>https://medium.com/cypik/how-to-set-up-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-e662263bbeed?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/e662263bbeed</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Mon, 15 Apr 2024 08:18:49 GMT</pubDate>
            <atom:updated>2024-05-30T11:46:59.038Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*twjI4X_gSNxDw46LISMg9w.png" /></figure><h3>What is the ELK Stack?</h3><p>The ELK Stack began as a collection of three open-source products — Elasticsearch, Logstash, and Kibana — all developed, managed and maintained by Elastic. The introduction and subsequent addition of Beats turned the stack into a four legged project.</p><p>Elasticsearch is a full-text search and analysis engine, based on the <a href="https://lucene.apache.org/">Apache Lucene</a> open source search engine.</p><p>Logstash is a log aggregator that collects data from various input sources, executes different transformations and enhancements and then ships the data to various supported output destinations. It’s important to know that many modern implementations of ELK do not include Logstash. To replace its log processing capabilities, most turn to lightweight alternatives like Fluentd, which can also collect logs from data sources and forward them to Elasticsearch.</p><p>Kibana is a visualization layer that works on top of Elasticsearch, providing users with the ability to analyze and visualize the data. And last but not least — Beats are lightweight agents that are installed on edge hosts to collect different types of data for forwarding into the stack.</p><p>Together, these different components are most commonly used for monitoring, troubleshooting and securing IT environments (though there are many more use cases for the ELK Stack such as business intelligence and web analytics). Beats and (formerly) Logstash take care of data collection and processing, Elasticsearch indexes and stores the data, and Kibana provides a user interface for querying the data and visualizing it.</p><p>The Elastic Stack has four main components:</p><ul><li><a href="https://www.elastic.co/products/elasticsearch"><strong>Elasticsearch</strong></a>: a distributed <a href="https://en.wikipedia.org/wiki/Representational_state_transfer"><em>RESTful</em></a> search engine which stores all of the collected data.</li><li><a href="https://www.elastic.co/products/logstash"><strong>Logstash</strong></a>: the data processing component of the Elastic Stack which sends incoming data to Elasticsearch.</li><li><a href="https://www.elastic.co/products/kibana"><strong>Kibana</strong></a>: a web interface for searching and visualizing logs.</li><li><a href="https://www.elastic.co/products/beats"><strong>Beats</strong></a>: lightweight, single-purpose data shippers that can send data from hundreds or thousands of machines to either Logstash or Elasticsearch.</li></ul><p>In this tutorial, you will install the <a href="https://www.elastic.co/elk-stack">Elastic Stack</a> on an Ubuntu 22.04 server. You will learn how to install all of the components of the Elastic Stack — including <a href="https://www.elastic.co/products/beats/filebeat">Filebeat</a>, a Beat used for forwarding and centralizing logs and files — and configure them to gather and visualize system logs. Additionally, because Kibana is normally only available on the localhost, we will use <a href="https://www.nginx.com/">Nginx</a> to proxy it so it will be accessible over a web browser. We will install all of these components on a single server, which we will refer to as our <em>Elastic Stack server</em>.</p><p><strong>Note</strong>: When installing the Elastic Stack, you must use the same version across the entire stack. In this tutorial we will install the latest versions of the entire stack which are, at the time of this writing, Elasticsearch 7.7.1, Kibana 7.7.1, Logstash 7.7.1, and Filebeat 7.7.1.</p><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#prerequisites">Prerequisites</a></h3><p>To complete this tutorial, you will need the following:</p><ul><li>An Ubuntu 22.04 server with 4GB RAM and 2 CPUs set up with a non-root sudo user. You can achieve this by following the <a href="https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04">Initial Server Setup with Ubuntu 22.04</a>.For this tutorial, we will work with the minimum amount of CPU and RAM required to run Elasticsearch. Note that the amount of CPU, RAM, and storage that your Elasticsearch server will require depends on the volume of logs that you expect.</li><li>OpenJDK 11 installed. See the section <a href="https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-22-04#installing-the-default-jrejdk">Installing the Default JRE/JDK</a> in our guide <a href="https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-22-04">How To Install Java with Apt on Ubuntu 22.04</a> to set this up.</li><li>Nginx installed on your server, which we will configure later in this guide as a reverse proxy for Kibana. Follow our guide on <a href="https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04">How to Install Nginx on Ubuntu 22.04</a> to set this up.</li></ul><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#step-1-installing-and-configuring-elasticsearch">Step 1 — Installing and Configuring Elasticsearch</a></h3><p>The Elasticsearch components are not available in Ubuntu’s default package repositories. They can, however, be installed with APT after adding Elastic’s package source list.</p><p>All of the packages are signed with the Elasticsearch signing key in order to protect your system from package spoofing. Packages which have been authenticated using the key will be considered trusted by your package manager. In this step, you will import the Elasticsearch public GPG key and add the Elastic package source list in order to install Elasticsearch.</p><p>To begin, use CURL, the command line tool for transferring data with URLs, to import the Elasticsearch public GPG key into APT. Note that we are using the arguments -fsSL to silence all progress and possible errors (except for a server failure) and to allow CURL to make a request on a new location if redirected. Pipe the output of the curl command to the gpg --dearmor command, which converts the key into a format that apt can use to verify downloaded packages.</p><pre>curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch |sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg</pre><p>Next, add the Elastic source list to the sources.list.d directory, where APT will search for new sources:</p><pre>echo &quot;deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main&quot; | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list</pre><p>The [signed-by=/usr/share/keyrings/elastic.gpg] portion of the file instructs apt to use the key that you downloaded to verify repository and file information for Elasticsearch packages.</p><p>Next, update your package lists so APT will read the new Elastic source:</p><pre>sudo apt update</pre><p>Then install Elasticsearch with this command:</p><pre>sudo apt install elasticsearch</pre><p>Elasticsearch is now installed and ready to be configured. Use your preferred text editor to edit Elasticsearch’s main configuration file, elasticsearch.yml. Here, we’ll use nano:</p><pre>sudo nano /etc/elasticsearch/elasticsearch.yml</pre><p>The elasticsearch.yml file provides configuration options for your cluster, node, paths, memory, network, discovery, and gateway. Most of these options are preconfigured in the file but you can change them according to your needs. For our demonstration of a single-server configuration, we will only adjust the settings for the network host.</p><p>Elasticsearch listens for traffic from everywhere on port 9200. You will want to restrict outside access to your Elasticsearch instance to prevent outsiders from reading your data or shutting down your Elasticsearch cluster through its [REST API] (<a href="https://en.wikipedia.org/wiki/Representational_state_transfer">https://en.wikipedia.org/wiki/Representational_state_transfer</a>). To restrict access and therefore increase security, find the line that specifies network.host, uncomment it, and replace its value with localhost like this:</p><pre>. . .<br># ---------------------------------- Network -----------------------------------<br>#<br># Set the bind address to a specific IP (IPv4 or IPv6):<br>#<br>network.host: localhost<br>. . .</pre><p>We have specified localhost so that Elasticsearch listens on all interfaces and bound IPs. If you want it to listen only on a specific interface, you can specify its IP in place of localhost. Save and close elasticsearch.yml. If you’re using nano, you can do so by pressing CTRL+X, followed by Y then press ENTER .</p><p>These are the minimum settings you can start with in order to use Elasticsearch. Now you can start Elasticsearch for the first time.</p><p>Start the Elasticsearch service with systemctl. Give Elasticsearch a few moments to start up. Otherwise, you may get errors about not being able to connect.</p><pre>sudo systemctl start elasticsearch</pre><p>Next, run the following command to enable Elasticsearch to start up every time your server boots:</p><pre>sudo systemctl enable elasticsearch</pre><p>You can test whether your Elasticsearch service is running by sending an HTTP request:</p><pre>curl -X GET &quot;localhost:9200&quot;</pre><p>You will see a response showing some basic information about your local node, similar to this:</p><pre>{<br>  &quot;name&quot; : &quot;arjun&quot;,<br>  &quot;cluster_name&quot; : &quot;elasticsearch&quot;,<br>  &quot;cluster_uuid&quot; : &quot;Yb7QOesAT62BTOlp44Lbng&quot;,<br>  &quot;version&quot; : {<br>    &quot;number&quot; : &quot;7.17.20&quot;,<br>    &quot;build_flavor&quot; : &quot;default&quot;,<br>    &quot;build_type&quot; : &quot;deb&quot;,<br>    &quot;build_hash&quot; : &quot;b26557f585b7d95c71a5549e571a6bcd2667697d&quot;,<br>    &quot;build_date&quot; : &quot;2024-04-08T08:34:31.070382898Z&quot;,<br>    &quot;build_snapshot&quot; : false,<br>    &quot;lucene_version&quot; : &quot;8.11.3&quot;,<br>    &quot;minimum_wire_compatibility_version&quot; : &quot;6.8.0&quot;,<br>    &quot;minimum_index_compatibility_version&quot; : &quot;6.0.0-beta1&quot;<br>  },<br>  &quot;tagline&quot; : &quot;You Know, for Searc</pre><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#step-2-installing-and-configuring-the-kibana-dashboard">Step 2 — Installing and Configuring the Kibana Dashboard</a></h3><p>According to the <a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">official documentation</a>, you should install Kibana only after installing Elasticsearch. Installing in this order ensures that the components each product depends on are correctly in place.</p><p>Because you’ve already added the Elastic package source in the previous step, you can just install the remaining components of the Elastic Stack using apt:</p><pre>sudo apt install kibana</pre><p>Then enable and start the Kibana service:</p><pre>sudo systemctl enable kibana</pre><pre>sudo systemctl start kibana</pre><p>Because Kibana is configured to only listen on localhost, we must set up a <a href="https://www.digitalocean.com/community/tutorials/digitalocean-community-glossary#reverse-proxy">reverse proxy</a> to allow external access to it. We will use Nginx for this purpose, which should already be installed on your server.</p><p>First, use the openssl command to create an administrative Kibana user which you’ll use to access the Kibana web interface. As an example we will name this account kibanaadmin, but to ensure greater security we recommend that you choose a non-standard name for your user that would be difficult to guess.</p><p>The following command will create the administrative Kibana user and password, and store them in the htpasswd.users file. You will configure Nginx to require this username and password and read this file momentarily</p><pre>echo &quot;kibanaadmin:`openssl passwd -apr1`&quot; | sudo tee -a /etc/nginx/htpasswd.users</pre><p>Enter and confirm a password at the prompt. Remember or take note of this login, as you will need it to access the Kibana web interface.</p><p>Next, we will create an Nginx server block file. As an example, we will refer to this file as your_domain, although you may find it helpful to give yours a more descriptive name. For instance, if you have a FQDN and DNS records set up for this server, you could name this file after your FQDN.</p><p>Using nano or your preferred text editor, create the Nginx server block file:</p><pre>sudo nano /etc/nginx/sites-available/your_domain</pre><p>Add the following code block into the file, being sure to update your_domain to match your server’s FQDN or public IP address. This code configures Nginx to direct your server’s HTTP traffic to the Kibana application, which is listening on localhost:5601. Additionally, it configures Nginx to read the htpasswd.users file and require basic authentication.</p><p>Note that if you followed the <a href="https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04">prerequisite Nginx tutorial</a> through to the end, you may have already created this file and populated it with some content. In that case, delete all the existing content in the file before adding the following</p><pre>server {<br>    listen 80;<br><br>    server_name your_domain;<br><br>    auth_basic &quot;Restricted Access&quot;;<br>    auth_basic_user_file /etc/nginx/htpasswd.users;<br><br>    location / {<br>        proxy_pass http://localhost:5601;<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &#39;upgrade&#39;;<br>        proxy_set_header Host $host;<br>        proxy_cache_bypass $http_upgrade;<br>    }<br>}</pre><p>When you’re finished, save and close the file.</p><p>Next, enable the new configuration by creating a symbolic link to the sites-enabled directory. If you already created a server block file with the same name in the Nginx prerequisite, you do not need to run this command</p><pre>sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/your_domain</pre><p>Then check the configuration for syntax errors:</p><pre>sudo nginx -t</pre><p>If any errors are reported in your output, go back and double check that the content you placed in your configuration file was added correctly. Once you see syntax is ok in the output, go ahead and restart the Nginx service:</p><pre>sudo systemctl reload nginx</pre><p>If you followed the initial server setup guide, you should have a UFW firewall enabled. To allow connections to Nginx, we can adjust the rules by typing</p><pre>sudo ufw allow &#39;Nginx Full&#39;</pre><p><strong>Note:</strong> If you followed the prerequisite Nginx tutorial, you may have created a UFW rule allowing the Nginx HTTP profile through the firewall. Because the Nginx Full profile allows both HTTP and HTTPS traffic through the firewall, you can safely delete the rule you created in the prerequisite tutorial. Do so with the following command</p><pre>sudo ufw delete allow &#39;Nginx HTTP&#39;</pre><p>Kibana is now accessible via your FQDN or the public IP address of your Elastic Stack server. You can check the Kibana server’s status page by navigating to the following address and entering your login credentials when prompted:</p><pre>http://your_domain/status</pre><p>This status page displays information about the server’s resource usage and lists the installed plugins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*TyVZe38YnPj9JJTscpg_aQ.png" /></figure><p><strong>Note</strong>: As mentioned in the Prerequisites section, it is recommended that you enable SSL/TLS on your server. You can follow <a href="https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04">the Let’s Encrypt</a> guide now to obtain a free TLS certificate for Nginx on Ubuntu 22.04. After obtaining your TLS certificates, you can come back and complete this tutorial.</p><p>Now that the Kibana dashboard is configured, let’s install the next component: Logstash.</p><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#step-3-installing-and-configuring-logstash">Step 3 — Installing and Configuring Logstash</a></h3><p>Although it’s possible for Beats to send data directly to the Elasticsearch database, it is common to use Logstash to process the data. This will allow you more flexibility to collect data from different sources, transform it into a common format, and export it to another database.</p><p>Install Logstash with this command:</p><pre>sudo apt install logstash</pre><p>After installing Logstash, you can move on to configuring it. Logstash’s configuration files reside in the /etc/logstash/conf.d directory. For more information on the configuration syntax, you can check out the <a href="https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html">configuration reference</a> that Elastic provides. As you configure the file, it’s helpful to think of Logstash as a pipeline which takes in data at one end, processes it in one way or another, and sends it out to its destination (in this case, the destination being Elasticsearch). A Logstash pipeline has two required elements, input and output, and one optional element, filter. The input plugins consume data from a source, the filter plugins process the data, and the output plugins write the data to a destination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*0ZLHfPsw2kV-cGutilifoQ.png" /></figure><p>Create a configuration file called 02-beats-input.conf where you will set up your Filebeat input:</p><pre>sudo nano /etc/logstash/conf.d/02-beats-input.conf</pre><p>Insert the following input configuration. This specifies a beats input that will listen on TCP port 5044.</p><pre>input {<br>  beats {<br>    port =&gt; 5044<br>  }<br>}</pre><p>Save and close the file.</p><p>Next, create a configuration file called 30-elasticsearch-output.conf:</p><pre>sudo nano /etc/logstash/conf.d/30-elasticsearch-output.conf</pre><p>Insert the following output configuration. Essentially, this output configures Logstash to store the Beats data in Elasticsearch, which is running at localhost:9200, in an index named after the Beat used. The Beat used in this tutorial is Filebeat:</p><pre>output {<br>  if [@metadata][pipeline] {<br> elasticsearch {<br>   hosts =&gt; [&quot;localhost:9200&quot;]<br>   manage_template =&gt; false<br>   index =&gt; &quot;%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}&quot;<br>   pipeline =&gt; &quot;%{[@metadata][pipeline]}&quot;<br> }<br>  } else {<br> elasticsearch {<br>   hosts =&gt; [&quot;localhost:9200&quot;]<br>   manage_template =&gt; false<br>   index =&gt; &quot;%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}&quot;<br> }<br>  }<br>}</pre><p>Save and close the file.</p><p>Test your Logstash configuration with this command:</p><pre>sudo -u logstash /usr/share/logstash/bin/logstash --path.settings /etc/logstash -t</pre><p>If there are no syntax errors, your output will display Config Validation Result: OK. Exiting Logstash after a few seconds. If you don’t see this in your output, check for any errors noted in your output and update your configuration to correct them. Note that you will receive warnings from OpenJDK, but they should not cause any problems and can be ignored.</p><p>If your configuration test is successful, start and enable Logstash to put the configuration changes into effect:</p><pre>sudo systemctl start logstash</pre><pre>sudo systemctl enable logstash</pre><p>Now that Logstash is running correctly and is fully configured, let’s install Filebeat.</p><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#step-4-installing-and-configuring-filebeat">Step 4 — Installing and Configuring Filebeat</a></h3><p>The Elastic Stack uses several lightweight data shippers called Beats to collect data from various sources and transport them to Logstash or Elasticsearch. Here are the Beats that are currently available from Elastic:</p><ul><li><a href="https://www.elastic.co/products/beats/filebeat">Filebeat</a>: collects and ships log files.</li><li><a href="https://www.elastic.co/products/beats/metricbeat">Metricbeat</a>: collects metrics from your systems and services.</li><li><a href="https://www.elastic.co/products/beats/packetbeat">Packetbeat</a>: collects and analyzes network data.</li><li><a href="https://www.elastic.co/products/beats/winlogbeat">Winlogbeat</a>: collects Windows event logs.</li><li><a href="https://www.elastic.co/products/beats/auditbeat">Auditbeat</a>: collects Linux audit framework data and monitors file integrity.</li><li><a href="https://www.elastic.co/products/beats/heartbeat">Heartbeat</a>: monitors services for their availability with active probing.</li></ul><p>In this tutorial we will use Filebeat to forward local logs to our Elastic Stack.</p><p>Install Filebeat using apt:</p><pre>sudo apt install filebeat</pre><p>Next, configure Filebeat to connect to Logstash. Here, we will modify the example configuration file that comes with Filebeat.</p><p>Open the Filebeat configuration file:</p><pre>sudo nano /etc/filebeat/filebeat.yml</pre><p><strong>Note:</strong> As with Elasticsearch, Filebeat’s configuration file is in YAML format. This means that proper indentation is crucial, so be sure to use the same number of spaces that are indicated in these instructions.</p><p>Filebeat supports numerous outputs, but you’ll usually only send events directly to Elasticsearch or to Logstash for additional processing. In this tutorial, we’ll use Logstash to perform additional processing on the data collected by Filebeat. Filebeat will not need to send any data directly to Elasticsearch, so let’s disable that output. To do so, find the output.elasticsearch section and comment out the following lines by preceding them with a:</p><pre>...<br>#output.elasticsearch:<br>  # Array of hosts to connect to.<br>  #hosts: [&quot;localhost:9200&quot;]<br>...</pre><p>Then, configure the output.logstash section. Uncomment the lines output.logstash: and hosts: [&quot;localhost:5044&quot;] by removing the #. This will configure Filebeat to connect to Logstash on your Elastic Stack server at port 5044, the port for which we specified a Logstash input earlier:</p><pre>output.logstash:<br>  # The Logstash hosts<br>  hosts: [&quot;localhost:5044&quot;]</pre><p>Save and close the file.</p><p>The functionality of Filebeat can be extended with <a href="https://www.elastic.co/guide/en/beats/filebeat/7.6/filebeat-modules.html">Filebeat modules</a>. In this tutorial we will use the <a href="https://www.elastic.co/guide/en/beats/filebeat/7.6/filebeat-module-system.html">system</a> module, which collects and parses logs created by the system logging service of common Linux distributions.</p><p>Let’s enable it:</p><pre>sudo filebeat modules enable system</pre><pre>sudo filebeat modules list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*4WV9V9X4SYIoh-RXUsFEnQ.png" /></figure><p>By default, Filebeat is configured to use default paths for the syslog and authorization logs. In the case of this tutorial, you do not need to change anything in the configuration. You can see the parameters of the module in the /etc/filebeat/modules.d/system.yml configuration file.</p><p>Next, we need to set up the Filebeat ingest pipelines, which parse the log data before sending it through logstash to Elasticsearch. To load the ingest pipeline for the system module, enter the following command:</p><pre>sudo filebeat setup --pipelines --modules system</pre><p>Next, load the index template into Elasticsearch. An <a href="https://www.elastic.co/blog/what-is-an-elasticsearch-index"><em>Elasticsearch index</em></a> is a collection of documents that have similar characteristics. Indexes are identified with a name, which is used to refer to the index when performing various operations within it. The index template will be automatically applied when a new index is created.</p><p>To load the template, use the following command:</p><pre>sudo filebeat setup --index-management -E output.logstash.enabled=false -E &#39;output.elasticsearch.hosts=[&quot;localhost:9200&quot;]&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*1n59WlyJOEAeCsuR9HG03w.png" /></figure><p>Filebeat comes packaged with sample Kibana dashboards that allow you to visualize Filebeat data in Kibana. Before you can use the dashboards, you need to create the index pattern and load the dashboards into Kibana.</p><p>As the dashboards load, Filebeat connects to Elasticsearch to check version information. To load dashboards when Logstash is enabled, you need to disable the Logstash output and enable Elasticsearch output:</p><pre>sudo filebeat setup -E output.logstash.enabled=false -E output.elasticsearch.hosts=[&#39;localhost:9200&#39;] -E setup.kibana.host=localhost:5601</pre><p>After a few minutes, you should receive output similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*NqFyRAx4EibEc0Q30WoHvg.png" /></figure><p>Now you can start and enable Filebeat:</p><pre>sudo systemctl start filebeat</pre><pre>sudo systemctl enable filebeat</pre><p>If you’ve set up your Elastic Stack correctly, Filebeat will begin shipping your syslog and authorization logs to Logstash, which will then load that data into Elasticsearch.</p><p>To verify that Elasticsearch is indeed receiving this data, query the Filebeat index with this command:</p><pre>curl -XGET &#39;http://localhost:9200/filebeat-*/_search?pretty&#39;</pre><p>You should receive output similar to this:</p><pre>{<br>  &quot;took&quot; : 3,<br>  &quot;timed_out&quot; : false,<br>  &quot;_shards&quot; : {<br>    &quot;total&quot; : 1,<br>    &quot;successful&quot; : 1,<br>    &quot;skipped&quot; : 0,<br>    &quot;failed&quot; : 0<br>  },<br>  &quot;hits&quot; : {<br>    &quot;total&quot; : {<br>      &quot;value&quot; : 0,<br>      &quot;relation&quot; : &quot;eq&quot;<br>    },<br>    &quot;max_score&quot; : null,<br>    &quot;hits&quot; : [ ]<br>  }<br>}</pre><p>If your output shows 0 total hits, Elasticsearch is not loading any logs under the index you searched for, and you will need to review your setup for errors. If you received the expected output, continue to the next step, in which we will see how to navigate through some of Kibana’s dashboards.</p><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-22-04#step-5-exploring-kibana-dashboards">Step 5 — Exploring Kibana Dashboards</a></h3><p>Let’s return to the Kibana web interface that we installed earlier.</p><p>In a web browser, go to the FQDN or public IP address of your Elastic Stack server. If your session has been interrupted, you will need to re-enter entering the credentials you defined in Step 2. Once you have logged in, you should receive the Kibana homepage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*6PeBYz6AOLbv0LVqvAJfHA.png" /></figure><p>Click the <strong>Discover</strong> link in the left-hand navigation bar (you may have to click the the <strong>Expand</strong> icon at the very bottom left to see the navigation menu items). On the <strong>Discover</strong> page, select the predefined <strong>filebeat-</strong>* index pattern to see Filebeat data. By default, this will show you all of the log data over the last 15 minutes. You will see a histogram with log events, and some log messages below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*CZBXW4JnY8JJ7S0g-4tj-A.png" /></figure><p>Here, you can search and browse through your logs and also customize your dashboard. At this point, though, there won’t be much in there because you are only gathering syslogs from your Elastic Stack server.</p><p>Use the left-hand panel to navigate to the <strong>Dashboard</strong> page and search for the <strong>Filebeat System</strong> dashboards. Once there, you can select the sample dashboards that come with Filebeat’s system module.</p><p>For example, you can view detailed stats based on your syslog messages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*WiY2Adz3Cpsi-PzZbJRp4g.png" /></figure><p>You can also view which users have used the sudo command and when:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*h3sS_Fv_W2mykClJhv0p1g.png" /></figure><p>Enjoy it! That’s It; we are done…</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e662263bbeed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/how-to-set-up-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-e662263bbeed">How to Set Up Elasticsearch, Logstash, and Kibana (Elastic Stack) on Ubuntu</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Grafana And How to Install Grafana on Ubuntu]]></title>
            <link>https://medium.com/cypik/what-is-grafana-and-how-to-install-grafana-on-ubuntu-da8a110aa07b?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/da8a110aa07b</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 04:43:06 GMT</pubDate>
            <atom:updated>2024-04-10T04:43:06.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXyUQR3cBQhP1N2yzbrnng.png" /></figure><h3>What is Grafana?</h3><p>Grafana enables you to create interactive and visually appealing dashboards for data visualization, similar to <a href="https://www.thoughtspot.com/data-trends/business-intelligence/tableau-competitors">Tableau or its competitors</a>. It allows real-time monitoring of various data sources, for example, for monitoring <a href="https://www.cherryservers.com/blog/kubernetes-monitoring-tools">Kubernetes clusters</a>, and supports in-depth data analysis, providing insights into your system’s performance. This can help you make more informed decisions. Grafana also allows you to set up alerts based on predefined conditions, notifying you of issues before they become problems.</p><h3>What is Grafana used for?</h3><p>Grafana is a popular open-source analytics and interactive visualization web application designed for monitoring and visualizing data and creating interactive dashboards. It allows you to query data and build graphs, charts, and dashboards of the data (metrics &amp; logs) from various supported data sources, making it easier to interpret and understand the data.</p><h3>Prerequisites</h3><p>This is a practical demonstration will show you how to install Grafana on Ubuntu 22.04 with practical examples, and to follow along, make sure you have:</p><ul><li>An Ubuntu server (for this demonstration, a server from <a href="https://www.cherryservers.com/blog/how-to-install-ubuntu-server">Cherry Servers</a> was used).</li><li>A non-root user with sudo access</li></ul><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-grafana-on-ubuntu-20-04#step-1-installing-grafana">Installing Grafana</a></h3><p>In this first step, you will install Grafana onto your Ubuntu 20.04 server. You can install Grafana either by <a href="https://grafana.com/grafana/download">downloading it directly from its official website</a> or by going through an <a href="https://www.digitalocean.com/community/tutorials/ubuntu-and-debian-package-management-essentials#debian-package-management-tools-overview">APT repository</a>. Because an APT repository makes it easier to install and manage Grafana’s updates, you’ll use that method in this tutorial.</p><p>Download the Grafana <a href="https://www.digitalocean.com/community/tutorials/how-to-use-gpg-to-encrypt-and-sign-messages">GPG key</a> with <a href="https://www.gnu.org/software/wget/">wget</a>, then <a href="https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-i-o-redirection#pipes">pipe the output</a> to apt-key. This will add the key to your APT installation’s list of trusted keys, which will allow you to download and verify the GPG-signed Grafana package:</p><pre>wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -</pre><p>In this command, the option -q turns off the status update message for wget, and -O outputs the file that you downloaded to the terminal. These two options ensure that only the contents of the downloaded file are pipelined to apt-key.</p><p>Next, add the Grafana repository to your APT sources:</p><pre>sudo add-apt-repository &quot;deb https://packages.grafana.com/oss/deb stable main&quot;</pre><p>Refresh your APT cache to update your package lists:</p><pre>sudo apt update</pre><p>You can now proceed with the installation:</p><pre>sudo apt install grafana</pre><p>Once Grafana is installed, use systemctl to start the Grafana server:</p><pre>sudo systemctl start grafana-server</pre><p>Next, verify that Grafana is running by checking the service’s status:</p><pre>sudo systemctl status grafana-server</pre><pre>Output<br>● grafana-server.service - Grafana instance<br>     Loaded: loaded (/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)<br>   Active: active (running) since Thu 2020-05-21 08:08:10 UTC; 4s ago<br>     Docs: http://docs.grafana.org<br> Main PID: 15982 (grafana-server)<br>    Tasks: 7 (limit: 1137)<br>...</pre><p>This output contains information about Grafana’s process, including its status, Main Process Identifier (PID), and more. active (running) shows that the process is running correctly.</p><p>Lastly, enable the service to automatically start Grafana on boot:</p><pre>sudo systemctl enable grafana-server</pre><p>Enjoy it! That’s It; we are done…</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>My name is Arjun lal Yadav, and I am an experienced Linux enthusiast and DevOps engineer. I am passionate about automating and streamlining development processes, and currently, I work at Cypik as a DevOps Engineer. My area of expertise includes optimizing software delivery pipelines and infrastructure management. I specialize in cloud technologies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da8a110aa07b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/what-is-grafana-and-how-to-install-grafana-on-ubuntu-da8a110aa07b">What Is Grafana And How to Install Grafana on Ubuntu</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Full Information About Docker]]></title>
            <link>https://medium.com/cypik/full-information-about-docker-0f25f09e763e?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f25f09e763e</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Tue, 02 Apr 2024 04:38:48 GMT</pubDate>
            <atom:updated>2024-04-10T11:48:43.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*BwZ1y7TMXNZAuA2k-AxWeQ.png" /></figure><h3>Docker overview</h3><p>Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. that Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production.</p><h3><a href="https://docs.docker.com/get-started/overview/#what-can-i-use-docker-for">What can I use Docker for?</a></h3><h4><a href="https://docs.docker.com/get-started/overview/#fast-consistent-delivery-of-your-applications">Fast, consistent delivery of your applications</a></h4><p>Docker streamlines the development lifecycle by allowing developers to work in standardized environments using local containers which provide your applications and services. Containers are great for continuous integration and continuous delivery (CI/CD) workflows.</p><p>Consider the following example scenario:</p><ul><li>Your developers write code locally and share their work with their colleagues using Docker containers.</li><li>They use Docker to push their applications into a test environment and run automated and manual tests.</li><li>When developers find bugs, they can fix them in the development environment and redeploy them to the test environment for testing and validation.</li><li>When testing is complete, getting the fix to the customer is as simple as pushing the updated image to the production environment.</li></ul><h3><a href="https://docs.docker.com/get-started/overview/#docker-architecture">Docker architecture</a></h3><p>Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface. Another Docker client is Docker Compose, which lets you work with applications consisting of a set of containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*y1FXdMluX6iPCdT6ac2r4w.png" /></figure><h3><a href="https://docs.docker.com/get-started/overview/#the-docker-daemon">The Docker daemon</a></h3><p>The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.</p><h3><a href="https://docs.docker.com/get-started/overview/#the-docker-client">The Docker client</a></h3><p>One of the main ways Docker users interact with Docker is through the Docker client. The Docker client sends commands such as “docker run” to dockerd, which then carries out these commands. The Docker client uses the Docker API and can communicate with multiple daemons.</p><h3><a href="https://docs.docker.com/get-started/overview/#docker-registries">Docker registries</a></h3><p>A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker looks for images on Docker Hub by default. You can even run your own private registry.</p><p>When you use the docker pull or docker run commands, Docker pulls the required images from your configured registry. When you use the docker push command, Docker pushes your image to your configured registry.</p><h4><a href="https://docs.docker.com/get-started/overview/#images">Images</a></h4><p>An image is a read-only template with instructions for creating a Docker container. Often, an image is based on another image, with some additional customization. For example, you may build an image that is based on the Ubuntu image but installs the Apache web server and your application, as well as the configuration details needed to make your application run.</p><h4><a href="https://docs.docker.com/get-started/overview/#containers">Containers</a></h4><p>A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.</p><p>By default, a container is relatively well isolated from other containers and its host machine. You can control how isolated a container’s network, storage, or other underlying subsystems are from other containers or the host machine.</p><p>A container is defined by its image as well as any configuration options you provide to it when you create or start it. When a container is removed, any changes to its state that aren’t stored in persistent storage disappear.</p><h3><a href="https://docs.docker.com/desktop/install/linux-install/#general-system-requirements">General system requirements</a></h3><p>To install Docker Desktop successfully, your Linux host must meet the following general requirements:</p><ul><li>64-bit kernel and CPU support for virtualization.</li><li>KVM virtualization support. Follow the <a href="https://docs.docker.com/desktop/install/linux-install/#kvm-virtualization-support">KVM virtualization support instructions</a> to check if the KVM kernel modules are enabled and how to provide access to the KVM device.</li><li>QEMU must be version 5.2 or later. We recommend upgrading to the latest version.</li><li>systemd init system.</li><li>Gnome, KDE, or MATE Desktop environment.</li><li>For many Linux distros, the Gnome environment does not support tray icons. To add support for tray icons, you need to install a Gnome extension. For example, <a href="https://extensions.gnome.org/extension/615/appindicator-support/">AppIndicator</a>.</li><li>At least 4 GB of RAM.</li><li>Enable configuring ID mapping in user namespaces, see <a href="https://docs.docker.com/desktop/faqs/linuxfaqs/#how-do-i-enable-file-sharing">File sharing</a>.</li><li>Recommended: <a href="https://docs.docker.com/desktop/get-started/#credentials-management-for-linux-users">Initialize </a><a href="https://docs.docker.com/desktop/get-started/#credentials-management-for-linux-users">pass</a> for credentials management.</li></ul><p>Docker Desktop for Linux runs a Virtual Machine (VM). For more information on why, see <a href="https://docs.docker.com/desktop/faqs/linuxfaqs/#why-does-docker-desktop-for-linux-run-a-vm">Why Docker Desktop for Linux runs a VM</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*d2HYYGVAP39ORZNv58MeiA.png" /></figure><h3>How To Install and Use Docker on Ubuntu</h3><h3><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04#step-1-installing-docker">Step 1 — Installing Docker</a></h3><p>First, update your existing list of packages:</p><pre>sudo apt update</pre><p>Next, install a few prerequisite packages that let apt use packages over HTTPS:</p><pre>sudo apt install apt-transport-https ca-certificates curl software-properties-common</pre><p>Then add the GPG key for the official Docker repository to your system:</p><pre>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</pre><p>Add the Docker repository to APT sources:</p><pre>sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable&quot;</pre><p>Finally, install Docker:</p><pre>sudo apt install docker.io</pre><p>Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:</p><pre>sudo systemctl status docker</pre><h3>DOCKER USEFUL COMMANDS</h3><h4>Docker build;</h4><pre>sudo docker build -t image . </pre><h4>how to show docker images;</h4><pre>sudo docker images</pre><h4>how to run image;</h4><pre>sudo docker run image</pre><h4>how to see running containers;</h4><pre>sudo docker ps </pre><h4>how to see all containers;</h4><pre>sudo docker ps -a </pre><h4>how to docker containers port mapping;</h4><pre>docker run -p 8080:80 image</pre><h4>how to go under the container/how to go in the container;</h4><pre>sudo docker exec -it container id  -/bin/bash</pre><h4>docker image tag;</h4><pre> sudo docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]</pre><h4>how to push image at Dockerhub;</h4><pre>sudo docker push image tag </pre><p>Enjoy it! That’s It; we are done…</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f25f09e763e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/full-information-about-docker-0f25f09e763e">Full Information About Docker</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is KEDA?]]></title>
            <link>https://medium.com/cypik/what-is-keda-d7c03270bfe1?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7c03270bfe1</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Thu, 14 Mar 2024 05:18:13 GMT</pubDate>
            <atom:updated>2024-04-10T11:47:48.296Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*ASoHpObsrcJP0zzOzZIOxA.png" /></figure><p><strong>KEDA</strong> is a <a href="https://kubernetes.io/">Kubernetes</a>-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed.</p><p><strong>KEDA</strong> is a single-purpose and lightweight component that can be added into any Kubernetes cluster. KEDA works alongside standard Kubernetes components like the <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/">Horizontal Pod Autoscaler</a> and can extend functionality without overwriting or duplication. With KEDA you can explicitly map the apps you want to use event-driven scale, with other apps continuing to function. This makes KEDA a flexible and safe option to run alongside any number of other Kubernetes applications or frameworks.</p><p>This an Example of using one of the cloud services available i.e.., Microsoft Azure to showcase how the KEDA works in a Real case scenario. KEDA can also be used in different Cloud Services available.</p><p>We provide a few approaches to deploy KEDA runtime in your Kubernetes clusters:</p><blockquote><em>💡 </em><strong><em>NOTE:</em></strong><em> KEDA requires Kubernetes cluster version 1.24 and higher</em></blockquote><p>Don’t see what you need? Feel free to <a href="https://github.com/kedacore/keda/issues/new">create an issue</a> on our GitHub repo.</p><p>Deploying KEDA with Helm is very simple:</p><ol><li>Adding keda to Helm</li></ol><pre>helm repo add kedacore https://kedacore.github.io/charts</pre><p>2. Update Helm repo</p><pre>helm repo update</pre><p>3. Install keda Helm chart</p><pre>helm install keda kedacore/keda --namespace keda --create-namespace</pre><p>To deploy the CRDs separately from the Helm chart, use the keda-2.xx.x-crds.yaml file provided on the <a href="https://github.com/kedacore/keda/releases">GitHub releases</a> page.</p><blockquote><em>💡 </em><strong><em>NOTE:</em></strong><em> Are you upgrading to v2.2.1 or above? Make sure to read </em><a href="https://keda.sh/docs/latest/troubleshooting/"><em>our troubleshooting guide</em></a><em> to fix potential CRD issues.</em></blockquote><p>This specification describes the azure-servicebus trigger for Azure Service Bus Queue or Topic.</p><p>⚠️ <strong>WARNING:</strong> KEDA is not in charge of managing entities. If the queue, topic or subscription does not exist, it will not create them automatically.</p><pre>triggers:<br>- type: azure-servicebus<br> metadata:<br> # Required: queueName OR topicName and subscriptionName<br> queueName: functions-sbqueue<br> # or<br> topicName: functions-sbtopic<br> subscriptionName: sbtopic-sub1<br> # Optional, required when pod identity is used<br> namespace: service-bus-namespace<br> # Optional, can use TriggerAuthentication as well<br> connectionFromEnv: SERVICEBUS_CONNECTIONSTRING_ENV_NAME<br> # Optional<br> messageCount: &quot;5&quot; # Optional. Count of messages to trigger scaling on. Default: 5 messages<br> activationMessageCount: &quot;2&quot;<br> cloud: Private # Optional. Default: AzurePublicCloud<br> endpointSuffix: servicebus.airgap.example # Required when cloud=Private</pre><p><strong>Parameter list:</strong></p><ul><li>messageCount - Amount of active messages in your Azure Service Bus queue or topic to scale on.</li><li>activationMessageCount - Target value for activating the scaler. Learn more about activation <a href="https://keda.sh/docs/2.13/concepts/scaling-deployments/#activating-and-scaling-thresholds">here</a>. (Default: 0, Optional)</li><li>queueName - Name of the Azure Service Bus queue to scale on. (Optional)</li><li>topicName - Name of the Azure Service Bus topic to scale on. (Optional)</li><li>subscriptionName - Name of the Azure Service Bus queue to scale on. (Optional*, Required when topicName is specified)</li><li>namespace - Name of the Azure Service Bus namespace that contains your queue or topic. (Optional*, Required when pod identity is used)</li><li>connectionFromEnv - Name of the environment variable your deployment uses to get the connection string of the Azure Service Bus namespace. (Optional)</li><li>useRegex - Provides indication whether or not a regex is used in the queueName or subscriptionName parameters. (Values: true, false, Default: false, Optional)</li><li>operation - Defines how to compute the number of messages when useRegex is set to true. (Values: sum, max, or avg, Default: sum, Optional).</li><li>cloud - Name of the cloud environment that the service bus belongs to. Must be a known Azure cloud environment, or Private for Azure Stack Hub or Air Gapped clouds. (valid values: AzurePublicCloud, AzureUSGovernmentCloud, AzureChinaCloud, AzureGermanCloud, Private; default: AzurePublicCloud)</li></ul><p>When cloud is set to Private, the endpointSuffix parameter is required. Otherwise, it is automatically generated based on the cloud environment. endpointSuffix represents the service bus endpoint suffix of the cloud environment that the service bus belongs to, e.g. servicebus.usgovcloudapi.net for AzureUSGovernmentCloud.</p><blockquote>💡 Service Bus Shared Access Policy needs to be of type . Manage access is required for KEDA to be able to get metrics from Service Bus.</blockquote><p>You can authenticate by using pod identity or connection string authentication.</p><p><strong>Connection String Authentication:</strong></p><ul><li>connection - Connection string for the Azure Service Bus Namespace.</li><li>The following formats are supported.</li><li>With <strong>SharedAccessKey</strong> — Endpoint=sb://&lt;sb&gt;.servicebus.windows.net/;SharedAccessKeyName=&lt;key name&gt;;SharedAccessKey=&lt;key value&gt;</li><li>With <strong>SharedAccessSignature</strong> -<br>Endpoint=sb://&lt;sb&gt;.servicebus.windows.net/;SharedAccessSignature=SharedAccessSignature sig=&lt;signature-string&gt;&amp;se=&lt;expiry&gt;&amp;skn=&lt;keyName&gt;&amp;sr=&lt;URL-encoded-resourceURI&gt;<br>Refer to this <a href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas">page</a> for more information on using Shared Access Signatures.</li></ul><p><strong>Pod identity based authentication:</strong></p><p><a href="https://docs.microsoft.com/en-us/azure/aks/use-azure-ad-pod-identity">Azure AD Pod Identity</a> or <a href="https://azure.github.io/azure-workload-identity/docs/">Azure AD Workload Identity</a> providers can be used.</p><p>Here is an example of how to use managed identity:</p><pre>apiVersion: keda.sh/v1alpha1<br>kind: TriggerAuthentication<br>metadata:<br> name: azure-servicebus-auth<br>spec:<br> podIdentity:<br> provider: azure | azure-workload<br>---<br>apiVersion: keda.sh/v1alpha1<br>kind: ScaledObject<br>metadata:<br> name: azure-servicebus-queue-scaledobject<br> namespace: default<br>spec:<br> scaleTargetRef:<br> name: azure-servicebus-queue-function<br> triggers:<br> - type: azure-servicebus<br> metadata:<br> # Required: queueName OR topicName and subscriptionName<br> queueName: functions-sbqueue<br> # or<br> topicName: functions-sbtopic<br> subscriptionName: sbtopic-sub1<br> # Required: Define what Azure Service Bus to authenticate to with Managed Identity<br> namespace: service-bus-namespace<br> # Optional<br> messageCount: &quot;5&quot; # default 5<br> cloud: AzureGermanCloud # Optional. Default: AzurePublicCloud<br> authenticationRef:<br> name: azure-servicebus-auth # authenticationRef would need either podIdentity or define a connection parameter</pre><h3>KEDA is unable to get queue information due to “invalid queue runtime properties: no CountDetails element”</h3><p>When KEDA logs show errors similar to invalid queue runtime properties: no CountDetails element it usually is caused because of throttling by Azure Service Bus.</p><p>Consider applying one of the following mitigations:</p><ul><li>Scaling the Azure Service Bus namespace to a higher SKU, or use premium</li><li>Increase the polling interval of the ScaledObject/ScaledJob</li><li>Use <a href="https://keda.sh/docs/2.13/concepts/scaling-deployments/#caching-metrics">caching of metrics</a></li></ul><p>Enjoy it! That’s It; we are done…</p><blockquote>For hassle-free Cloud Management with DevOps at the center of the process, contact us at <a href="/service/mailto:info@cypik.com">info@cypik.com</a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author: </em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c03270bfe1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/what-is-keda-d7c03270bfe1">What is KEDA?</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Docker Compose: A Comprehensive Introduction]]></title>
            <link>https://medium.com/cypik/getting-started-with-docker-compose-a-comprehensive-introduction-e14529c13e37?source=rss-6aaccc8be253------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14529c13e37</guid>
            <dc:creator><![CDATA[Arjun Yadav]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 07:56:09 GMT</pubDate>
            <atom:updated>2026-07-23T11:24:16.650Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnbtcrPItJl-c9XXQbtprQ.png" /></figure><blockquote><em>When using Docker extensively, the management of several different containers quickly becomes cumbersome. Docker Compose is a tool that helps us overcome this problem andeasily handle multiple containers at once. In this tutorial, we’ll have a look at its main features and powerful mechanisms.</em></blockquote><h3>Wondering what Docker Compose is?</h3><p>Docker is the leading containerization tool in the DevOps landscape, but Docker Compose is what makes managing multi-container applications seamless. Instead of manually building, connecting, and running separate Dockerfiles for each component of a technology stack — which can be complex and time-consuming — Docker Compose uses a single YAML file to orchestrate the entire environment. With just one command, you can build and launch all your containers simultaneously. This is indispensable for enterprise-level production, where it allows teams to manage hundreds of containers with ease, significantly improving efficiency and deployment speed.</p><h3>The Docker Compose File</h3><p>Docker Compose works by applying many rules declared within a single <strong><em>docker-compose.yml</em></strong> configuration file. These YAML rules, both human-readable and machine-optimized, provide us an effective way to snapshot the whole project from ten-thousand feet in a few lines. Almost every rule replaces a specific Docker command so that in the end we just need to run :</p><pre>docker-compose up</pre><p>We can get dozens of configurations applied by Compose under the hood. This will save us the hassle of scripting them with Bash or something else.</p><p>In this file, we need to specify the <em>version</em> of the Compose file format, at least one <em>service</em>, and optionally <em>volumes</em> and <em>networks</em>:</p><p>Let’s see what these elements actually are.</p><h3>1. Services</h3><p>First of all, <em>services</em> refer to containers’ configuration.</p><p>For example, let’s take a dockerized web application consisting of a front end, a back end, and a database: We’d likely split those components into three images and define them as three different services in the configuration:</p><p>There are multiple settings that we can apply to services.</p><p>Sometimes, the image we need for our service has already been published (by us or by others) in <a href="https://hub.docker.com/">Docker Hub</a>, or another Docker Registry. If that’s the case, then we refer to it with the image attribute, by specifying the image name and tag:</p><p>Instead, we might need to <a href="https://docs.docker.com/compose/compose-file/#build">build</a> an image from the source code by reading its <em>Dockerfile</em>. This time, we’ll use the <em>build</em> keyword, passing the path to the Dockerfile as the value:</p><pre>services: my-custom-app: build: /path/to/dockerfile/ ...</pre><p>Docker containers communicate between themselves in networks created, implicitly or through configuration, by Docker Compose. A service can communicate with another service on the same network by simply referencing it by container name and port (for example <em>network-example-service:80</em>), provided that we’ve made the port accessible through the <em>expose</em> keyword:</p><pre>services: network-example-service: image: karthequian/helloworld:latest expose: - &quot;80&quot;</pre><p>There are three types of volumes: ones. Docker manages both anonymous and named volumes, automatically mounting them in self-generated directories in the host. While anonymous volumes were useful with older versions of Docker, named ones are the suggested way to go nowadays. Host volumes also allow us to specify an existing folder in the host. We can configure host volumes at the service level and named volumes in the outer level of the configuration, in order to make the latter visible to other containers and not only to the one they belong:</p><pre>services: volumes-example-service: image: alpine:latest volumes: - my-named-global-volume:/my-volumes/named-global-volume - /tmp:/my-volumes/host-volume - /home:/my-volumes/readonly-host-volume:ro ... another-volumes-example-service: image: alpine:latest volumes: - my-named-global-volume:/another-path/the-same-named-volume ... volumes: my-named-global-volume:</pre><p>Here, both containers will have read/write access to the <em>my-named-global-volume</em> shared folder, no matter the different paths they’ve mapped it to. The two host volumes, instead, will be available only to <em>volumes-example-service</em>. The <em>/tmp</em> folder of the host’s file system is mapped to the <em>/my-volumes/host-volume</em> folder of the container. This portion of the file system is writeable, which means that the container can not only read but also write (and delete) files in the host machine.</p><p>Often, we need to create a dependency chain between our services, so that some services get loaded before (and unloaded after) other ones. We can achieve this result through the <em>depends_on</em> keyword:</p><pre>services: kafka: image: wurstmeister/kafka:2.11-0.11.0.3 depends_on: - zookeeper ... zookeeper: image: wurstmeister/zookeeper ...</pre><p>We should be aware, however, that Compose will not wait for the <em>zookeeper</em> service to finish loading before starting the <em>kafka</em> service: it will simply wait for it to start. If we need a service to be fully loaded before starting another service, we need to get deeper control of startup and shutdown order in Compose.</p><h3>2. Volumes &amp; Networks</h3><p><em>Volumes</em>, on the other hand, are physical areas of disk space shared between the host and a container, or even between containers. In other words, a volume is a shared directory in the host, visible from some or all containers. Similarly, <em>networks</em> define the communication rules between containers, and between a container and the host. Common network zones will make containers’ services discoverable by each other, while private zones will segregate them in virtual sandboxes.</p><h3>3. Managing Environment Variables :</h3><p>Working with environment variables is easy in Compose. We can define static environment variables, and also define dynamic variables with the <em>${}</em> notation:</p><pre>services: database: image: &quot;postgres:${POSTGRES_VERSION}&quot; environment: DB: mydb USER: &quot;${USER}&quot;</pre><p>There are different methods to provide those values to Compose. For example, one is setting them in a <em>.env</em> file in the same directory, structured like a <em>.properties</em> file, <em>key=value</em>:</p><pre>POSTGRES_VERSION=alpine USER=foo</pre><p>Otherwise, we can set them in the OS before calling the command:</p><pre>export POSTGRES_VERSION=alpine export USER=foo docker-compose up</pre><p>Finally, we might find handy using a simple one-liner in the shell:</p><pre>POSTGRES_VERSION=alpine USER=foo docker-compose up</pre><p>We can mix the approaches, but let’s keep in mind that Compose uses the following priority order, overwriting the less important with the higher ones:</p><ol><li>Compose file</li><li>Shell environment variables</li><li>Environment file</li><li>Dockerfile</li><li>Variable not defined</li></ol><h3>3. Scaling and Replicas :</h3><p>In older Compose versions, we were allowed to scale the instances of a container through the <a href="https://docs.docker.com/compose/reference/scale/"><em>docker-compose scale</em></a> command. Newer versions deprecated it and replaced it with the <em>— -scale</em> option. On the other side, we can exploit <a href="https://docs.docker.com/engine/swarm/">Docker Swarm</a> — a cluster of Docker Engines — and autoscale our containers declaratively through the <em>replicas</em> attribute of the <em>deploy</em> section:</p><p>Under <em>deploy,</em> we can also specify many other options, like the resources thresholds. Compose, however, considers the whole <em>deploy</em> section only when deploying to Swarm, and ignores it otherwise.</p><blockquote><em>For hassle-free Cloud Management with DevOps at the center of the process, contact us at </em><a href="/service/mailto:info@cypik.com"><em>info@cypik.com</em></a><em><br></em><a href="https://www.linkedin.com/company/cypik"><em>Cypik</em></a></blockquote><p><strong><em>About the author:</em></strong><br>I’m <a href="https://medium.com/@arjun.y">Arjun</a> , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14529c13e37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cypik/getting-started-with-docker-compose-a-comprehensive-introduction-e14529c13e37">Getting Started with Docker Compose: A Comprehensive Introduction</a> was originally published in <a href="https://medium.com/cypik">Cypik</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>