<?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 Mehmet kanus on Medium]]></title>
        <description><![CDATA[Stories by Mehmet kanus on Medium]]></description>
        <link>https://medium.com/@mehmetkanus17?source=rss-8f06d8dffb1f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mY4atEXZEL4C63jWxjpdZg.jpeg</url>
            <title>Stories by Mehmet kanus on Medium</title>
            <link>https://medium.com/@mehmetkanus17?source=rss-8f06d8dffb1f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:18:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehmetkanus17/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[End-to-End DevOps Project: Multi-Master Kubernetes Infrastructure with Terraform, Ansible &…]]></title>
            <link>https://medium.com/@mehmetkanus17/end-to-end-devops-project-multi-master-kubernetes-with-terraform-ansible-gitops-ci-cd-vault-af7f27b82941?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/af7f27b82941</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubespray]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Fri, 08 Aug 2025 22:40:48 GMT</pubDate>
            <atom:updated>2025-08-09T13:05:42.038Z</atom:updated>
            <content:encoded><![CDATA[<h3>End-to-End DevOps Project: Multi-Master Kubernetes Infrastructure with Terraform, Ansible &amp; Kubespray, GitOps CI/CD, Vault Integration, Observability &amp; Auto-Scaling</h3><p>Hello everyone! I’m thrilled to share a comprehensive <strong>DevOps project</strong> I’ve recently completed. This project allowed me to build a full-scale, end-to-end system for <strong>continuous integration and continuous delivery (CI/CD)</strong>, complete with robust <strong>observability</strong> features. To make it even more challenging and realistic, I simulated an <strong>on-premise environment</strong> entirely within <strong>Azure cloud</strong>.</p><p>In this article, I’ll walk you through the entire process, covering key stages and the tools I used. We’ll start by looking at how I built the <strong>infrastructure</strong> from the ground up. Then, we’ll dive into the <strong>CI/CD pipeline</strong>, detailing how applications are automatically built, tested, and deployed. Finally, I’ll explain how I set up <strong>observability</strong> to monitor everything, ensuring our applications run smoothly.</p><p>Here’s a quick overview of what we’ll cover:</p><h3>What We Will Do in This Project</h3><h3>1. Infrastructure</h3><ul><li><strong>Provision virtual machines</strong> using <strong>Terraform</strong> to set up a total of nine machines in Azure, including three Kubernetes masters, three workers, an HAProxy load balancer, an Ansible server for Kubespray, and an NFS server.</li><li><strong>Deploy a multi-master, multi-worker Kubernetes cluster</strong> with <strong>Kubespray</strong>, orchestrated by <strong>Ansible</strong>.</li><li><strong>Configure Ingress for external access</strong> using <strong>Nginx Ingress Controller</strong>, with <strong>HAProxy</strong> handling initial load balancing.</li><li><strong>Set up NFS storage</strong> to support <strong>Persistent Volume Claims (PVCs)</strong> for stateful applications.</li><li><strong>Install HashiCorp Vault</strong> and integrate it with Kubernetes using <strong>External Secrets Operator</strong> for secure secret management.</li><li>Store all infrastructure-as-code files in a dedicated Git repository.</li></ul><h3>2. CI/CD</h3><ul><li>Select a simple <strong>.NET Core application</strong> that uses a relational database (<strong>PostgreSQL</strong>), persists data, and has at least one UI screen.</li><li>Store the application code in a Git repository.</li><li>Use a <strong>GitOps approach</strong> where <strong>GitHub Actions</strong> (the CI tool) triggers <strong>ArgoCD</strong> (the CD tool) for deployments — CI will not deploy directly.</li><li>Create two namespaces (<strong>dev and prod</strong>) in the same Kubernetes cluster to represent different environments.</li><li>Store Kubernetes manifests in a Git repository, with environment-specific differences handled via <strong>kustomization.yaml</strong> files in a single branch.</li><li>Implement a <strong>CI pipeline using GitHub Actions</strong> with steps like code analysis (SAST), application build, container image creation, pushing to <strong>Harbor</strong> (my private registry), triggering dev deployment, dynamic security testing (DAST), manual approval for prod, triggering prod deployment, and merging feature branches.</li></ul><h3>3. Observability</h3><ul><li>Deploy monitoring and tracing tools such as <strong>Prometheus </strong>and <strong>Elastic</strong> to collect logs, metrics, and traces.</li><li>Create dashboards in <strong>Grafana</strong> or <strong>Kibana</strong>.</li><li>Configure alerts using <strong>Alertmanager</strong>, sending notifications to Slack.</li><li>Use <strong>Locust</strong> to generate load and trigger alerts, also to test the system’s performance under pressure.</li></ul><h3>4. Common Requirements</h3><ul><li>All <strong>ReadWriteMany PVCs</strong> must be provisioned from <strong>NFS</strong>.</li><li>All secrets must be stored in <strong>Vault</strong> — the actual secret values will never be pushed to Git. <strong>External Secrets Operator</strong> is used for Vault–Kubernetes integration.</li></ul><p>By the end of this article, you’ll have a clear understanding of how to implement a robust DevOps solution from infrastructure provisioning to continuous deployment and comprehensive monitoring.</p><p>Let’s get started!</p><h3><strong>Getting Started: Cloning the Repositories</strong></h3><p>To get started with this project, you’ll need to clone three separate Git repositories. These repos contain all the necessary files for the infrastructure, the sample application, and the Kubernetes manifests.</p><p>First, clone the infrastructure repository to set up your environment:</p><pre>git clone https://github.com/mehmetkanus17/infra-devops.git</pre><p>Next, clone the application repository, which holds the sample .NET Core application code:</p><pre>git clone https://github.com/mehmetkanus17/app-devops.git</pre><p>Finally, clone the manifest repository. This repo contains all the Kubernetes YAML files for deploying the application to your cluster:</p><pre>git clone https://github.com/mehmetkanus17/manifest-devops.git</pre><p>Clone these repositories to your local machine or any environment where you’ll be working on the project.</p><p>After cloning the first repository, you’ll need to make a small but crucial change.</p><p>Once you’ve cloned the infra-devops.git repository, navigate to the <strong>providers.tf</strong> file within the Terraform directory. Here, you&#39;ll need to <strong>update the </strong><strong>subscription_id with your own Azure subscription ID</strong>.</p><p>If you’re working with a different cloud provider instead of Azure, you’ll need to <strong>adjust the Terraform files accordingly</strong> to match your chosen provider’s configurations. This might involve changing provider blocks and resource definitions to fit your cloud environment.</p><h3>Running the Infrastructure Script</h3><p>You’ll start by executing the <strong>infra.sh</strong> script located in your cloned infra-devops.git repository. When you run this script, it&#39;ll prompt you to <strong>choose one of the following environments: </strong><strong>dev, </strong><strong>staging, or </strong><strong>prod</strong>. Select the environment you wish to set up for your initial deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqBI7PATb2YGuG0sK1KJsQ.gif" /></figure><p>Once Terraform finishes creating all the underlying infrastructure resources, the next step is to set up our Kubernetes cluster. This will happen on the <strong>Ansible host</strong>, where <strong>Kubespray</strong> will be used to deploy a highly available (HA) Kubernetes cluster. This means our cluster will be resilient and can withstand failures of individual components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wcm1qTGcVSSRN1RnurZoEQ.gif" /></figure><p>After the highly available Kubernetes cluster is set up on the Ansible host using Kubespray, the process moves to the <strong>HAProxy host</strong>. Here, all the remaining necessary components and requirements will be loaded <strong>into the Kubernetes cluster</strong>. This includes things like the Ingress Controller, secret management tools, and other essential services that allow your applications to run and be accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ayfS0grdpeH3dWa65qCtiQ.gif" /></figure><p>Once <strong>Terraform</strong> has finished provisioning all the underlying infrastructure, <strong>Ansible Kubespray</strong> has successfully set up the highly available Kubernetes cluster, and all the infrastructure requirements are installed on the <strong>HAProxy server</strong>, you’ll be able to access the dashboards of the relevant tools from your <strong>Ingress hosts</strong>. This means you can start checking the status and performance of your new setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OojdPFVERsxcILpCSTTgUQ.gif" /></figure><p>Now that our infrastructure is set up, we need to perform some manual steps on the <strong>HAProxy host</strong> to configure our <strong>Harbor</strong> registry and <strong>HashiCorp Vault</strong>. These commands will create a private project in Harbor, set up image pull secrets for our Kubernetes cluster, and store our application’s PostgreSQL connection string in Vault.</p><p><strong>Important:</strong> These commands should be run on the HAProxy server <strong>after all infrastructure is deployed and you’ve verified that all service pods within the Kubernetes cluster are in a </strong><strong>Running state.</strong></p><p>Here are the commands you’ll execute:</p><pre>#!/bin/bash<br><br># This script needs to be run on the HAProxy server.<br># It should be executed after all infrastructure is deployed and all service pods on the HAProxy server are confirmed to be running.<br> <br># 1. Create a private project in Harbor<br># We&#39;re creating a new project in Harbor called &#39;app-mehmetkanus&#39; and setting it to private.<br>curl -k -u admin:&#39;Mkanus-123*-&#39; -X POST &quot;https://harbor.prod.goxdev.lol/api/v2.0/projects&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;project_name&quot;: &quot;app-mehmetkanus&quot;,<br>    &quot;public&quot;: false<br>}&#39;<br><br># 2. Create imagePullSecrets for Harbor<br># These secrets allow our Kubernetes cluster to pull images from our private Harbor registry.<br># We create one for the &#39;dev&#39; namespace and another for the &#39;prod&#39; namespace.<br>kubectl create secret docker-registry harbor-pull-secret \<br>  --docker-server=harbor.prod.goxdev.lol \<br>  --docker-username=admin \<br>  --docker-password=Mkanus-123*- \<br>  --docker-email=mehmetkanus0117@gmail.com \<br>  -n dev<br>kubectl create secret docker-registry harbor-pull-secret \<br>  --docker-server=harbor.prod.goxdev.lol \<br>  --docker-username=admin \<br>  --docker-password=Mkanus-123*- \<br>  --docker-email=mehmetkanus0117@gmail.com \<br>  -n prod<br><br># 3. Store PostgreSQL Connection String in HashiCorp Vault<br># We&#39;re manually inserting the application&#39;s PostgreSQL connection string into Vault.<br># This data could also be entered via the Vault portal, but we&#39;re doing it via kubectl for automation.<br><br># For the &#39;dev&#39; environment:<br>kubectl exec -n vault vault-0 -- /bin/sh -c &#39;<br>vault kv put secret/dev/appsettings appsettings.json=&#39;\&#39;&#39;<br>{<br>  &quot;Logging&quot;: {<br>    &quot;LogLevel&quot;: {<br>      &quot;Default&quot;: &quot;Information&quot;,<br>      &quot;Microsoft.AspNetCore&quot;: &quot;Warning&quot;<br>    }<br>  },<br>  &quot;AllowedHosts&quot;: &quot;*&quot;,<br>  &quot;ConnectionStrings&quot;: {<br>    &quot;DefaultConnection&quot;: &quot;Host=postgresql.postgresql.svc.cluster.local;Port=5432;Database=mkanus;Username=mkanus;Password=mkanus123&quot;<br>  }<br>}&#39;\&#39;&#39;&#39;<br><br># For the &#39;prod&#39; environment:<br>kubectl exec -n vault vault-0 -- /bin/sh -c &#39;<br>vault kv put secret/prod/appsettings appsettings.json=&#39;\&#39;&#39;<br>{<br>  &quot;Logging&quot;: {<br>    &quot;LogLevel&quot;: {<br>      &quot;Default&quot;: &quot;Information&quot;,<br>      &quot;Microsoft.AspNetCore&quot;: &quot;Warning&quot;<br>    }<br>  },<br>  &quot;AllowedHosts&quot;: &quot;*&quot;,<br>  &quot;ConnectionStrings&quot;: {<br>    &quot;DefaultConnection&quot;: &quot;Host=postgresql.postgresql.svc.cluster.local;Port=5432;Database=mkanus;Username=mkanus;Password=mkanus123&quot;<br>  }<br>}&#39;\&#39;&#39;&#39;</pre><p>These steps are critical for the secure and proper functioning of our application within the Kubernetes cluster, ensuring images can be pulled from our private registry and sensitive database connection details are managed by Vault.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2emI7zqZzmEQj314lX0ixg.gif" /></figure><h3>CI/CD Phase: Continuous Integration (CI)</h3><p>Our <strong>Infrastructure</strong> phase is now complete, and we have a fully set up Kubernetes cluster with all its supporting services. We’re now moving into the exciting <strong>CI/CD phase</strong>, starting with <strong>Continuous Integration (CI)</strong>.</p><p>In this section, we’ll focus on how <strong>GitHub Actions</strong> orchestrates our CI process. Specifically, you’ll see how a <strong>GitHub Actions workflow file</strong> automatically builds our application, creates a container image, and pushes that image to our <strong>Harbor registry</strong>. This automation is a crucial step in ensuring our application changes are quickly and consistently prepared for deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9q6ilQFdZGtSzqJxGJSOMg.gif" /></figure><h3>Moving to Continuous Delivery with ArgoCD</h3><p>Now, let’s shift our focus to the <strong>Continuous Delivery (CD)</strong> aspect of our pipeline using <strong>ArgoCD</strong>. Since our Git repositories are private, we first need to introduce them to ArgoCD. This step is crucial because it allows ArgoCD to continuously synchronize with our manifest files and ensure our deployments reflect the desired state in Git.</p><p>After we’ve set up the private repositories, we’ll proceed to create <strong>separate applications for both our </strong><strong>dev and </strong><strong>prod environments</strong> directly from the ArgoCD dashboard. This will enable ArgoCD to manage the deployments for each environment independently, pulling the necessary configurations from our manifest repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6o9WWjqBpqVs3dOsIZXTdA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5drMG1oFlzJ0tCuoWaqaA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9YIEJmcLVaL-qnF1RV3Hkw.gif" /></figure><h3>Finally: Observability</h3><p>With our CI/CD pipeline in place and applications deployed, the final crucial step is to observe and monitor their performance. In this <strong>Observability</strong> section, we’ll dive into the dashboards of <strong>Grafana</strong>, <strong>Kibana</strong>, and <strong>Locust</strong> to gather essential insights.</p><p>We’ll use <strong>Grafana</strong> to visualize metrics collected from our Kubernetes cluster and applications, providing a clear overview of their health and performance. <strong>Kibana</strong> will be our window into the logs, allowing us to search, analyze, and troubleshoot any issues that arise. Finally, we’ll examine the <strong>Locust</strong> dashboard to understand the results of our load tests, seeing how our system performed under simulated heavy traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPjXrYyDKfujq_DWQHH3XA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MbORbEjSui7qQtdi5zUlTQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7I7MJYeykZhx9jaBczncQ.gif" /></figure><p>By analyzing the data presented in these dashboards, we can gain a comprehensive understanding of our system’s behavior, identify potential bottlenecks, and ensure its stability and efficiency.</p><p>This concludes our journey through building a robust DevOps solution, from infrastructure provisioning and automated CI/CD to comprehensive observability. I hope this guide has provided valuable insights into implementing a modern DevOps pipeline.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af7f27b82941" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ArgoCD + GitHub Actions: A Complete GitOps CI/CD Workflow for Kubernetes Applications]]></title>
            <link>https://medium.com/@mehmetkanus17/argocd-github-actions-a-complete-gitops-ci-cd-workflow-for-kubernetes-applications-ed2f91d37641?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed2f91d37641</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[argo-cd]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Mon, 30 Jun 2025 15:31:20 GMT</pubDate>
            <atom:updated>2025-08-08T11:46:33.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgIeRA40tqhLPUSpJ1kMzw.png" /></figure><p>In this article, we’ll walk through a real-world GitOps workflow using ArgoCD, GitHub Actions, and Kubernetes. The goal is to automate the deployment pipeline such that:</p><ul><li>Your application is built with GitHub Actions.</li><li>Docker images are pushed to GitHub Container Registry (GHCR).</li><li>ArgoCD detects the updated image tag in your GitOps repository and syncs the Kubernetes manifests accordingly.</li></ul><p>This fully automated pipeline ensures consistency, auditability, and speed — all key benefits of modern DevOps practices.</p><h4><strong>Architecture Overview</strong></h4><ol><li>CI Pipeline with GitHub Actions<br> — Build the application.<br> — Tag and push the Docker image to GHCR.<br> — Update the image tag in the GitOps repository.</li><li>GitOps Repository<br> — Contains Kubernetes manifests managed by ArgoCD.<br> — ArgoCD syncs changes to kubernetes automatically or manually based on configuration.</li><li>ArgoCD<br> — Monitors the GitOps repo.<br> — Reconciles the desired state (Git) with the live state (Kubernetes).</li></ol><h4><strong>Prerequisites</strong></h4><p>-Kubernetes cluster configured and running<br>- ArgoCD installed on the kubernetes cluster<br>- A GitHub repository for your application code (CI repo)<br>- A separate GitHub repository for your Kubernetes manifests (GitOps repo)<br>- GitHub Container Registry enabled<br>- kubectl and ArgoCD CLI configured locally</p><p><strong>First, clone the following repositories to your own GitHub account and set them as private:</strong></p><ul><li><a href="https://github.com/mehmetkanus17/argocd-app.git">argocd-app</a></li><li><a href="https://github.com/mehmetkanus17/argocd-deploy.git">argocd-deploy</a></li></ul><blockquote>These repositories contain the application source code and the GitOps deployment manifests respectively.</blockquote><h4>Step 1 — Install ArgoCD on Your Kubernetes Cluster Using Helm</h4><p>To begin, we’ll deploy <strong>ArgoCD</strong> on our existing Kubernetes cluster using the official <strong>Helm chart</strong>. This will set up the GitOps controller that continuously reconciles the state between your Git repository and the cluster.</p><p>You can install ArgoCD with the following commands:</p><pre>#!/bin/bash<br><br>helm repo add argo https://argoproj.github.io/argo-helm<br>helm repo update<br><br>kubectl create namespace argocd<br><br># argocd-values.yaml<br>configs:<br>  cm:<br>    admin.enabled: true # -- Enable local admin user<br>    timeout.reconciliation: 15s # -- Timeout to discover if a new manifests version got published to the repository<br>    timeout.hard.reconciliation: 0s # -- Timeout to refresh application data as well as target manifests cache<br><br>helm upgrade --install argocd argo/argo-cd \<br>  --namespace argocd -f argocd-values.yaml<br><br># We are setting configs.cm.timeout.reconciliation to 15s<br># to reduce the default reconciliation interval (which is 180 seconds) <br># and allow ArgoCD to detect and apply changes more quickly.<br># This value is configurable based on your desired sync frequency.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_q52zcYaQBAdCmCq1H_yg.gif" /></figure><h4>Step 2— Access the ArgoCD Dashboard and Register Your App Repository</h4><p>You can access the ArgoCD dashboard by port-forwarding the ArgoCD server service:</p><pre>kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath=&quot;{.data.password}&quot; | base64 -d; echo<br>kubectl port-forward svc/argocd-server -n argocd 8080:80</pre><p><strong>Note:</strong> You can manually set or update the ArgoCD admin password using the commands below.</p><pre>htpasswd -nbBC 10 &quot;&quot; &quot;yourNewPassword&quot; | tr -d &#39;:\n&#39; | sed &#39;s/$2y/$2a/&#39;<br><br><br>kubectl -n argocd patch secret argocd-secret \<br>  -p &#39;{&quot;stringData&quot;: {<br>    &quot;admin.password&quot;: &quot;$2a$10$1p3WDFDfgfhdfnJQ0xJwahav.nLgZxDOzrJqnK.P0/rxgAoyQFJ3/rWa&quot;,<br>    &quot;admin.passwordMtime&quot;: &quot;&#39;$(date +%FT%T%Z)&#39;&quot;<br>  }}&#39;<br><br>kubectl -n argocd rollout restart deployment argocd-server</pre><p>Then, open your browser and navigate to:<br> 👉 <a href="https://localhost:8080/">https://localhost:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3Wuh2mHrPU9_cJPj3bmyw.png" /></figure><p>Once logged in, follow the steps I described in my “<a href="https://medium.com/hedgus/introduction-to-argocd-streamlining-kubernetes-deployments-c2409b8743e9">previous article</a>” to connect your app repository and create a new ArgoCD application pointing to your GitOps deployment manifests.</p><blockquote>This step allows ArgoCD to continuously monitor your manifests and automatically sync updates to your Kubernetes cluster.</blockquote><h4>Step 3— Let’s Talk About the GitHub Actions Workflow File</h4><p>In this step, we’ll define a <strong>CI workflow</strong> that builds and pushes a Docker image to GitHub Container Registry (GHCR) whenever changes are pushed to the main branch. This is the first part of our GitOps pipeline, where the application is continuously integrated and containerized.</p><p>Here’s a basic structure of the workflow file:</p><pre>name: ArgoCD App<br><br>on:<br>  push:<br>    branches:<br>      - main<br>  # pull_request:<br>  #   branches:<br>  #     - main<br><br>env:<br>  IMAGE_NAME: ghcr.io/${{ github.repository }}/app<br>  GITOPS_REPO: mkanus/argocd-deploy<br><br>jobs:<br>  build-and-deploy:<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout source code<br>        uses: actions/checkout@v3<br><br>      - name: Log in to GitHub Container Registry<br>        uses: docker/login-action@v2<br>        with:<br>          registry: ghcr.io<br>          username: ${{ github.repository_owner }}<br>          password: ${{ secrets.CR_PAT }}<br><br>      - name: Set up Docker Buildx<br>        uses: docker/setup-buildx-action@v2<br><br>      - name: Build and push Docker image<br>        uses: docker/build-push-action@v4<br>        with:<br>          context: .<br>          push: true<br>          tags: |<br>            ${{ env.IMAGE_NAME }}:latest<br>            ${{ env.IMAGE_NAME }}:${{ github.sha }}<br><br>      - name: Update GitOps deployment repo<br>        run: |<br>          git clone https://${{ secrets.GITOPS_PAT }}@github.com/${{ env.GITOPS_REPO }} gitops<br>          cd gitops<br>          <br>          # Update the manifest with the latest image tag<br>          export IMAGE_NAME=&quot;${{ env.IMAGE_NAME }}&quot;<br>          export TAG=&quot;${{ github.sha }}&quot;<br><br>          sed -i &quot;s|image: ${IMAGE_NAME}:.*|image: ${IMAGE_NAME}:${TAG}|g&quot; deployment.yaml<br><br>          # Git Commit and Push Steps<br>          git config user.name &quot;GitHub Actions&quot;<br>          git config user.email &quot;actions@github.com&quot;<br><br>          git add deployment.yaml<br>          git commit -m &quot;Update image to ${{ github.sha }}&quot;<br>          git push origin main</pre><p><em>Under your private app repository, navigate to </em><strong><em>Settings &gt; Secrets and variables &gt; Actions</em></strong><em>, and add the following secret environment variables:</em></p><p><strong><em>CR_PAT </em></strong><em>and </em><strong><em>GITOPS_PAT</em></strong></p><p><em>You can assign your own Personal Access Tokens (PATs) with the necessary permissions to these secrets.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiYKU5TwlKUpJzzffYpLOQ.png" /></figure><h4>Step 4— Create an ImagePullSecret in the Application Namespace to Access Private Images</h4><p>Since our repository is private, the container images pushed to GitHub Container Registry (GHCR) are also private by default. To allow Kubernetes to pull these images, we need to create a <strong>docker-registry type secret</strong> in the application’s namespace.</p><pre>kubectl create secret docker-registry ghcr \<br>  --docker-server=ghcr.io \<br>  --docker-username=&lt;your-github-username&gt; \<br>  --docker-password=&lt;your-personal-access-token&gt; \<br>  --namespace=&lt;your-app-namespace&gt;</pre><h4><strong>Step 5— Trigger the CI Pipeline from the Private </strong><strong>argocd-app Repository</strong></h4><p>Now, let’s trigger the <strong>CI pipeline</strong> from our private argocd-app repository.</p><p><strong><em>This will start the GitHub Actions workflow, build the Docker image, push it to GHCR, and update the image tag in the GitOps repository.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GtTqQ_FUXfYKk5K_Ry5Zmg.gif" /></figure><p><em>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider </em><strong><em>following</em></strong><em> me and giving the article a </em><strong><em>clap</em></strong><em>. Your support means a lot and helps me continue creating content that you love.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed2f91d37641" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install Elastic Stack (Filebeat, Logstash, Elasticsearch, and Kibana) on Kubernetes Using Helm]]></title>
            <link>https://medium.com/@mehmetkanus17/how-to-deploy-elastic-stack-filebeat-logstash-elasticsearch-and-kibana-on-kubernetes-using-f6c763037da6?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6c763037da6</guid>
            <category><![CDATA[logstash]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[elk-stack]]></category>
            <category><![CDATA[kibana]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 12:46:21 GMT</pubDate>
            <atom:updated>2025-06-16T19:16:02.080Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*XUwEzsOaZ6JFYcJLWkT1eg.png" /></figure><p>The ELK Stack is a popular open-source solution for collecting, searching, analyzing, and visualizing large volumes of data in real time. It consists of <strong>Elasticsearch</strong>, <strong>Logstash</strong>, and <strong>Kibana</strong> — three powerful tools that work together to help organizations handle logs and other data effectively. In most modern setups, <strong>Filebeat</strong> is also included as a lightweight agent that collects and forwards logs from servers to Logstash or Elasticsearch directly. While <strong>Elasticsearch</strong> stores and searches data, <strong>Logstash</strong> processes and transforms it, and <strong>Kibana</strong> visualizes it through dashboards. Together, these tools provide a complete solution for log management, system monitoring, and data analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*tf67Xny5OomWUDQCB8GBbQ.png" /></figure><h3>How to Install ELK Stack?</h3><p>I will install the ELK Stack on a Kubernetes cluster using Helm. If you want, you can also create your cluster on any cloud provider or with kubeadm and continue from there.</p><h3>Install a released version using the Helm repository</h3><ul><li>Add the Elastic Helm charts repo:</li></ul><pre>helm repo add elastic https://helm.elastic.co</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*m_KvAFHsWKVjMEiHqT0dIQ.png" /></figure><ol><li><strong>Filebeat: </strong>It reads log files and sends them to Elasticsearch or Logstash. It is lightweight and uses very few system resources.</li></ol><p>Download the <strong>Filebeat values.yaml</strong> file using this command and make the following changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*WyJprKdEEQr4jHgenzlY9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCnoWliPcmoU6Tz6WRZF7w.png" /></figure><p><strong>2. Logstash: </strong>It is a data pipeline tool that collects and processes logs and event data. It can filter, transform, and enrich the data. Sources can be files, databases, message queues, etc.</p><p>Download the <strong>Logstash values.yaml</strong> file using this command and make the following changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*gwjbUuUMHsuG_f44nOTNHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vzInrFycXuLRJYslfvKZ8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7TLg-Hf_7eh6bCdbKRJmZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pbftwmgX2V7G31dUp2vhMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvaaMBfPCjyAAIRld-GzPw.png" /></figure><p><strong>3. Elasticsearch: </strong>It is a search and analytics engine. All logs, metrics, and event data are stored here. It is JSON-based, scalable, and works in a distributed way.</p><p>Download the <strong>Elasticsearch values.yaml</strong> file using this command and make the following changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*428n04o87sZZf30Fg8ring.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8x0drTmFdt2kEE7Mylpp4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zKTjtw7-sfh6gXWxYZWMVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGJysU9KN_a2-wlVQ5FV6Q.png" /></figure><p><strong>4. Kibana:</strong> It allows visualization and analysis of the data stored in Elasticsearch. It provides a user interface with tools like dashboards, graphs, and tables.</p><p>Download the <strong>Kibana values.yaml</strong> file using this command and make the following changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*j1z-Wx0s5gnQswnb9miLoQ.png" /></figure><p>There is no need to make any changes in the values.yaml file.</p><blockquote><strong><em>We can also install Metricbeat as an additional component.</em></strong></blockquote><p><strong>5. Metricbeat: </strong>It collects server metrics such as CPU, RAM, Disk, Network, etc. By sending this data to Elasticsearch, system health can be monitored.</p><p>Download the <strong>metricbeat values.yaml</strong> file using this command and make the following changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SOrPP0BoeMeyyt2kr6C9w.png" /></figure><p><strong><em>After setting up all 5 components in the elk_stack main folder, we can start the installation using the shell script below.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*CzU_YmorPuGD_02JXdtZ7Q.png" /></figure><pre>#!/bin/bash<br><br># environments<br>NAMESPACE=&quot;elasticsearch&quot;<br>VALUES_FILE=&quot;values.yaml&quot;<br><br># create namespace<br>echo &quot;checking the namespace: $NAMESPACE&quot;<br>if ! kubectl get namespace &quot;$NAMESPACE&quot; &amp;&gt;/dev/null; then<br>    echo &quot;Namespace &#39;$NAMESPACE&#39; not found, creating...&quot;<br>    kubectl create namespace &quot;$NAMESPACE&quot;<br>else<br>    echo &quot;Namespace &#39;$NAMESPACE&#39; already existed, passing.&quot;<br>fi<br><br># Add the Elastic Helm charts repo<br>helm repo add elastic https://helm.elastic.co<br><br># install elasticsearch<br>cd elasticsearch<br>helm upgrade --install elastic elastic/elasticsearch --version 8.5.1 -f $VALUES_FILE -n $NAMESPACE<br><br># install filebeat<br>cd ../filebeat<br>helm upgrade --install filebeat elastic/filebeat --version 8.5.1 -f $VALUES_FILE -n $NAMESPACE<br><br># install logstash<br>cd ../logstash<br>helm upgrade --install logstash elastic/logstash --version 8.5.1 -f $VALUES_FILE -n $NAMESPACE <br><br># install kibana<br>cd ../kibana<br>helm upgrade --install kibana elastic/kibana --version 8.5.1 -f $VALUES_FILE -n $NAMESPACE<br><br># install metricbeat<br>cd ../metricbeat<br>helm upgrade --install metricbeat elastic/metricbeat --version 8.5.1 -f $VALUES_FILE -n $NAMESPACE<br><br># Change Persistent Volume Claim Reclaim Policy for elasticsearch<br>kubectl get pv | grep Delete | awk &#39;{print$1}&#39; | xargs -I %  kubectl patch pv % -p &#39;{&quot;spec&quot;:{&quot;persistentVolumeReclaimPolicy&quot;:&quot;Retain&quot;}}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O3ecyIQQvG4FbowKN7w9iw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiZukWh1CMe4riBGqF41Cg.png" /></figure><p><em>Let’s get the Elasticsearch username and password using the commands below. Then, by port-forwarding the Kibana service, we can access the dashboard from localhost to view our cluster’s logs and metric data.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WYClureG5oA-lgqj5eo87w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojVdg6riN7d82IjLPam9Yg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RO-RekxmXH5Oufeto5-HoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7757arAhT8aFDGalXZ0sgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwQNSEwQWpOKqwCgoxWYoA.png" /></figure><p><em>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider </em><strong><em>following</em></strong><em> me and giving the article a </em><strong><em>clap</em></strong><em>. Your support means a lot and helps me continue creating content that you love.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6c763037da6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Redirect Unreachable Traffic to Custom Error Pages in Kubernetes Using Nginx]]></title>
            <link>https://medium.com/hedgus/handling-application-failures-in-kubernetes-redirecting-unreachable-traffic-to-custom-error-pages-d30be1276455?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d30be1276455</guid>
            <category><![CDATA[backend-services]]></category>
            <category><![CDATA[nginx-ingress]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[custom-error-page]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 13:54:52 GMT</pubDate>
            <atom:updated>2024-08-07T06:30:32.722Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In the fast-paced digital world, providing a seamless user experience is essential, even when your website faces downtime. Default error pages can be confusing and off-putting to users. Instead, redirecting traffic to a custom error page or a backend service can improve user satisfaction and convey important information clearly. This article focuses on setting up custom error pages in Kubernetes using Nginx Ingress Controller, ensuring that users see your specified error page or are redirected to a backend service when your application becomes unreachable.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpY64eXhansc1acrrw0yWg.png" /></figure><h3><em>Why Use Custom Error Pages or Backend Services?</em></h3><p><em>When users encounter an unreachable application, default error pages can lead to frustration and confusion. Custom error pages and backend services provide tailored messages that can guide users, offer alternative actions, or simply inform them about the issue in a user-friendly manner. This enhances the overall user experience, maintains brand consistency, and reduces user frustration during downtimes.</em></p><h3><em>Purpose of This Guide</em></h3><p><em>This guide aims to provide a step-by-step approach to configuring custom error pages and backend services in Kubernetes with Nginx Ingress Controller. By following these instructions, you will learn how to set up your Kubernetes cluster to automatically redirect users to a specified error page or a backend service when your primary application is down. This setup is crucial for maintaining a professional and user-friendly interface, even in the face of application failures.</em></p><h3>Prerequisites</h3><ul><li><strong>Kubernetes Cluster</strong>: Ensure you have a Kubernetes cluster set up.</li><li><strong>Nginx Ingress Controller</strong>: Nginx should be installed and configured as your ingress controller.</li><li><strong>Cert-Manager</strong>: Ensure cert-manager is installed and configured to manage TLS certificates automatically.</li><li><strong>Primary Application</strong>: Your main application deployed in the cluster.</li><li><strong>Backup Service</strong>: A secondary service to handle requests when the primary application is unreachable.</li></ul><p><strong>Step-1:</strong> First, ensure your Kubernetes cluster is up and running. If you haven’t set it up yet, you can do so using a cloud provider of your choice (e.g., Azure AKS, AWS EKS, GKE). I will be setting up the Kubernetes cluster on Azure AKS.</p><pre>az group create --name rg-mkanus --location westus<br><br>az aks create --resource-group rg-mkanus --name mkanus --location westus --kubernetes-version 1.30.0 --tier standard --enable-cluster-autoscaler --min-count 2 --max-count 3 --max-pods 110 --node-vm-size Standard_D8ds_v5 --network-plugin azure --network-policy azure --load-balancer-sku standard --generate-ssh-key</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*L5DJkH5eUKJ-V5V15nrPvQ.png" /></figure><p><strong>Step-2: Nginx Ingress Controller:</strong> Nginx should be installed and configured as your ingress controller. This involves setting up Nginx to manage and route external traffic to the appropriate services within your Kubernetes cluster, ensuring secure and efficient traffic handling.</p><pre>helm repo add nginx https://kubernetes.github.io/ingress-nginx<br>helm repo update<br>helm upgrade --install ingress-nginx nginx/ingress-nginx --create-namespace --namespace nginx --set controller.service.externalTrafficPolicy=&quot;Local&quot;,controller.allowSnippetAnnotations=true</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9bVBh9v5toWwegocF_cAg.png" /></figure><p><strong>Step-3:</strong> <strong>Cert-Manager:</strong> Ensure cert-manager is installed and configured to manage TLS certificates automatically. This tool helps automate the issuance and renewal of TLS certificates, ensuring your applications maintain secure HTTPS connections without manual intervention.</p><pre>helm repo add jetstack https://charts.jetstack.io<br>helm repo update<br>helm upgrade --install cert-manager jetstack/cert-manager --create-namespace --namespace cert-manager --set crds.enabled=true,crds.keep=false --version v1.15.1<br><br># kubectl apply -f clusterissuer.yaml<br>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-prod<br>spec:<br>  acme:<br>    email: mehmetkanus17@gmail.com<br>    server: &#39;https://acme-v02.api.letsencrypt.org/directory&#39;<br>    privateKeySecretRef:<br>      name: letsencrypt-prod<br>    solvers:<br>      - http01:<br>          ingress:<br>            class: nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyQGI8_TWQRV8ogaQHvDXg.png" /></figure><p><strong>Step-4:</strong> <strong>Primary Application:</strong> Your main application deployed in the cluster. This is the core service that your users interact with, hosted within the Kubernetes environment to leverage its scalability and orchestration capabilities.</p><pre># kubectl apply -f product.yaml<br><br>apiVersion: v1<br>kind: Namespace<br>metadata:<br>  name: product<br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  labels:<br>    app: shopping<br>  name: shopping<br>  namespace: product<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: shopping<br>  template:<br>    metadata:<br>      labels:<br>        app: shopping<br>    spec:<br>      containers:<br>      - image: ghcr.io/mehmetkanus17/shopping:latest<br>        name: shopping<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  labels:<br>    app: shopping<br>  name: shopping-svc<br>  namespace: product<br>spec:<br>  ports:<br>  - port: 80<br>    protocol: TCP<br>    targetPort: 80<br>  selector:<br>    app: shopping<br>---<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  namespace: product<br>  name: shopping-ingress<br>  annotations:<br>    cert-manager.io/cluster-issuer: letsencrypt-prod<br>    nginx.ingress.kubernetes.io/ssl-redirect: &quot;true&quot;<br>spec:<br>  ingressClassName: nginx<br>  tls:<br>  - hosts:<br>    - shop.mehmetkanus.com<br>    secretName: tls-shopping<br>  rules:<br>    - host: shop.mehmetkanus.com<br>      http:<br>        paths:<br>          - path: /<br>            pathType: Prefix<br>            backend:<br>              service:<br>                name: shopping-svc<br>                port:<br>                  number: 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjPmwfWLCyHDkwxxMuTasA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*eQ0GiakURF7J3E4OMUkHNw.png" /></figure><ul><li><em>We have deployed the product application to Kubernetes. Let’s create an A record in the DNS provider for the generated ingress host name and check if our site is accessible.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRLklPJlX6ic0R0i--cmPA.png" /></figure><p><strong>Step-5: Backup Service:</strong> A Backup Service acts as a secondary support system that takes over handling requests if the primary application becomes unavailable. This ensures continuous availability and reliability of services by redirecting traffic to the backup system during downtime or failures of the main application. Let’s deploy the backend service and application now.</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  labels:<br>    app: backend<br>  name: backend<br>  namespace: product<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: backend<br>  template:<br>    metadata:<br>      labels:<br>        app: backend<br>    spec:<br>      containers:<br>      - image: ghcr.io/mehmetkanus17/backend:latest<br>        name: backend<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  labels:<br>    app: backend<br>  name: backend-svc<br>  namespace: product<br>spec:<br>  ports:<br>  - port: 80<br>    protocol: TCP<br>    targetPort: 80<br>  selector:<br>    app: backend</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*ikP9cs-9hWrOLx2FNRgDKw.png" /></figure><p><strong>Step-6:</strong> To ensure access to the backend service if the main application is unreachable, we need to make two updates. First, we’ll modify the NGINX ingress controller deployment to specify the default backend service. Then, we’ll update the ingress YAML file to handle custom HTTP error responses by redirecting them to the backend service.</p><ol><li><strong>Edit the NGINX Ingress Controller Deployment:</strong></li></ol><pre># Update the deployment specification to include the product/backend service.<br># k edit -n nginx deploy ingress-nginx-controller<br><br>spec:<br>  containers:<br>  - args:<br>    ...<br>    ...<br>    ...<br>    - --default-backend-service=product/backend-svc # namespace/svc_name</pre><p>2. <strong>Update the Ingress YAML File: </strong>Add the following defaultBackend block to the ingress.yaml file and reapply the file.</p><pre># Add the defaultBackend block to specify the backend service<br>spec:<br>  ingressClassName: nginx<br>  defaultBackend:<br>    service:<br>      name: backend-svc<br>      port:<br>        number: 80<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*ra1sNtjF7jOe9F5F5aKPlw.png" /></figure><ul><li>Additionally, add custom HTTP error handling annotations to ingress.yaml file.</li></ul><pre>annotations:<br>  nginx.ingress.kubernetes.io/custom-http-errors: &quot;400,401,402,403,404,405,406,415,500,501,502,503,504,505&quot;</pre><ul><li><strong><em>These configurations ensure that requests are redirected to the backend service if the main application is unreachable or encounters specified HTTP errors.</em></strong></li></ul><p><strong>Last-Step: </strong>For this scenario, let’s assume we cannot access our main application. To simulate this, either remove the main application service or set the main application’s deployment replicas to 0. After making these changes, attempt to access our site again and observe what happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*hMbx5iLXOQ5iM5hUEKZmhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6BM1LfRUulaunTLkQtslrg.gif" /></figure><p><em>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider </em><strong><em>following</em></strong><em> me and giving the article a </em><strong><em>clap</em></strong><em>. Your support means a lot and helps me continue creating content that you love.</em></p><p><strong><em>Thanks again, and happy reading!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d30be1276455" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/handling-application-failures-in-kubernetes-redirecting-unreachable-traffic-to-custom-error-pages-d30be1276455">How to Redirect Unreachable Traffic to Custom Error Pages in Kubernetes Using Nginx</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Velero: Kubernetes Backup and Restore Solution for AWS EKS]]></title>
            <link>https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-for-aws-eks-763910b32fef?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/763910b32fef</guid>
            <category><![CDATA[velero-restore]]></category>
            <category><![CDATA[velero]]></category>
            <category><![CDATA[velero-backup]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 15:23:04 GMT</pubDate>
            <atom:updated>2024-07-06T20:01:20.845Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><a href="https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-0cbd56f449be"><strong>In my previous article</strong>,</a> I discussed the installation of Velero on Azure AKS, including taking backups of Azure AKS and restoring them to another Azure AKS cluster in the event of a cluster crash. Now, I will demonstrate how to install Velero on AWS EKS, take backups of AWS EKS, and restore them to another AWS EKS cluster.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aIPW0mLbBScVjG4cewjdNw.png" /></figure><p><a href="https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-0cbd56f449be">Velero: Kubernetes Backup and Restore Solution for Azure AKS</a></p><p><strong>Step-1:</strong> First, In the application I will create on AWS EKS, I will use a dynamic volume for persistent volume claims and expose the application to external traffic. To obtain a certificate from Let’s Encrypt, I will set up cert-manager. I will deploy ingress-nginx to acquire an external IP and expose the application. Subsequently, I will create the necessary records in my DNS provider, Route 53, to make my host publicly accessible.</p><pre># creating namespaces<br>kubectl create ns cert-manager<br>kubectl create ns nginx<br><br># adding and update helm-charts<br>helm repo add jetstack https://charts.jetstack.io<br>helm repo add nginx https://kubernetes.github.io/ingress-nginx<br>helm repo update<br><br># install cert-manager<br>helm upgrade --install cert-manager jetstack/cert-manager --create-namespace --namespace cert-manager --set installCRDs=true<br><br># note: Before installing ingress-nginx, create a helm-nginx.yaml file locally.<br># helm-nginx.yaml<br>controller:<br>  service:<br>    annotations:<br>      service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-0exxxxxxxxxxxxx # public subnet id<br>      service.beta.kubernetes.io/aws-load-balancer-type: nlb<br>      service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp<br>      service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing<br><br># install ingress-nginx<br>helm upgrade --install ingress-nginx nginx/ingress-nginx --create-namespace --namespace nginx -f helm-nginx.yaml<br><br># apply cert-cluster-issuer.yaml<br>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-staging<br>spec:<br>  acme:<br>    email: mehmetkanus17@gmail.com<br>    server: https://acme-staging-v02.api.letsencrypt.org/directory<br>    privateKeySecretRef:<br>      name: issuer-account-key<br>    solvers:<br>      - http01:<br>          ingress:<br>            class: nginx<br>---<br>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-prod<br>spec:<br>  acme:<br>    email: mehmetkanus17@gmail.com<br>    server: &#39;https://acme-v02.api.letsencrypt.org/directory&#39;<br>    privateKeySecretRef:<br>      name: letsencrypt-prod<br>    solvers:<br>      - http01:<br>          ingress:<br>            class: nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGfpzzOpwrv0umV3_Hm_2g.png" /></figure><p><strong>Step-2:</strong> Before deploying my application to AWS EKS, I will configure a few more settings. I will create an IAM OIDC provider for the cluster and an Amazon EBS CSI driver IAM role for service accounts.</p><pre># Creating an IAM OIDC provider for your cluster<br>oidc_id=$(aws eks describe-cluster --name EKS1 --query &quot;cluster.identity.oidc.issuer&quot; --output text | cut -d &#39;/&#39; -f 5)<br>aws iam list-open-id-connect-providers | grep $oidc_id<br>eksctl utils associate-iam-oidc-provider --region=us-east-1 --cluster=EKS1 --approve<br><br># check again<br>aws iam list-open-id-connect-providers | grep $oidc_id<br># output<br>- Arn: arn:aws:iam::xxxxxxxxxx:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/xxxxxxxxxxxxxxxxxxxxxxx</pre><p><strong>Step-3:</strong> To create your Amazon EBS CSI plugin IAM role with eksctl, use the eksctl create iamserviceaccount command to provision the necessary IAM role and attach it to your EKS cluster.</p><pre>eksctl create iamserviceaccount \<br>  --name ebs-csi-controller-sa \<br>  --namespace kube-system \<br>  --cluster EKS1 \<br>  --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \<br>  --approve \<br>  --role-only \<br>  --role-name AmazonEKS_EBS_CSI_DriverRole</pre><p><strong>Step-4:</strong> Now, I will deploy the sample application and ingress-nginx.</p><pre># ingress-nginx.yaml<br>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: id-ingress<br>  annotations:<br>    nginx.ingress.kubernetes.io/rewrite-target: /<br>    service.beta.kubernetes.io/aws-load-balancer-type: nlb<br>    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp<br>    service.beta.kubernetes.io/aws-load-balancer-scheme: &quot;internet-facing&quot;<br>    cert-manager.io/cluster-issuer: letsencrypt-prod<br>spec:<br>  ingressClassName: nginx<br>  tls:<br>  - hosts:<br>    - id.mehmetkanus<br>    secretName: tls-app<br>  rules:<br>    - host: id.mehmetkanus.com<br>      http:<br>        paths:<br>          - path: /<br>            pathType: Prefix<br>            backend:<br>              service:<br>                name: web-service<br>                port:<br>                  number: 80<br>    - host: id.mehmetkanus.com<br>      http:<br>        paths:<br>          - path: /result<br>            pathType: Prefix<br>            backend:<br>              service:<br>                name: result-service<br>                port:<br>                  number: 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2biu_t2dzcjdIxH_03PCiA.png" /></figure><p><strong>Step-5:</strong> Now, let’s create an alias A record in Route 53 with the DNS name of our application’s load balancer and view the entire interface of our site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ApZtlDq1qQ_NqQ-cRO1dUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wxv3R0SWem4J5CL98sZEUw.png" /></figure><h3>Install Velero to EKS1:</h3><p><strong>1- Create an S3 Bucket to store backups.</strong></p><pre># Replace &lt;BUCKETNAME&gt; and &lt;REGION&gt; with your own values below.<br><br>BUCKET=&lt;BUCKETNAME&gt;<br>REGION=&lt;REGION&gt;<br>aws s3 mb s3://$BUCKET --region $REGION</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xoex2YxtaL2GAkEM10H3TA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1hV6B6NdkMdonSq_M6qhw.png" /></figure><p><strong>2- create IAM Policy.</strong></p><pre>cat &gt; velero_policy.json &lt;&lt;EOF<br>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;ec2:DescribeVolumes&quot;,<br>                &quot;ec2:DescribeSnapshots&quot;,<br>                &quot;ec2:CreateTags&quot;,<br>                &quot;ec2:CreateVolume&quot;,<br>                &quot;ec2:CreateSnapshot&quot;,<br>                &quot;ec2:DeleteSnapshot&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        },<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:GetObject&quot;,<br>                &quot;s3:DeleteObject&quot;,<br>                &quot;s3:PutObject&quot;,<br>                &quot;s3:AbortMultipartUpload&quot;,<br>                &quot;s3:ListMultipartUploadParts&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:s3:::${BUCKET}/*&quot;<br>            ]<br>        },<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:ListBucket&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:s3:::${BUCKET}&quot;<br>            ]<br>        }<br>    ]<br>}<br>EOF<br><br>aws iam create-policy \<br>    --policy-name VeleroAccessPolicy \<br>    --policy-document file://velero_policy.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_eUkLZDw_xTK-A2kYuHVA.png" /></figure><p><strong>3- Create Service Accounts for Velero.</strong></p><pre>PRIMARY_CLUSTER=EKS1<br>ACCOUNT=$(aws sts get-caller-identity --query Account --output text)<br><br>eksctl create iamserviceaccount \<br>    --cluster=$PRIMARY_CLUSTER \<br>    --name=velero-server \<br>    --namespace=velero \<br>    --role-name=eks-velero-backup \<br>    --role-only \<br>    --attach-policy-arn=arn:aws:iam::$ACCOUNT:policy/VeleroAccessPolicy \<br>    --approve</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FRSVNLW1N8Qx9pWYJp53w.png" /></figure><p><strong>4- Install Velero in EKS1 Clusters.</strong></p><pre># add helm repo<br>helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts<br><br># create values.yaml file for install velero helm chart<br>cat &gt; values.yaml &lt;&lt;EOF<br>configuration:<br>  backupStorageLocation:<br>  - bucket: $BUCKET<br>    provider: aws<br>  volumeSnapshotLocation:<br>  - config:<br>      region: $REGION<br>    provider: aws<br>initContainers:<br>- name: velero-plugin-for-aws<br>  image: velero/velero-plugin-for-aws:v1.7.1<br>  volumeMounts:<br>  - mountPath: /target<br>    name: plugins<br>credentials:<br>  useSecret: false<br>serviceAccount:<br>  server:<br>    annotations:<br>      eks.amazonaws.com/role-arn: &quot;arn:aws:iam::${ACCOUNT}:role/eks-velero-backup&quot;<br>EOF<br> <br># install velero to EKS1<br>helm install velero vmware-tanzu/velero \<br>    --create-namespace \<br>    --namespace velero \<br>    -f values.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*kWaGfs_8OG_ULvpBTwWGrg.png" /></figure><p><strong>5- Backup all resources in all namespaces including persistent volumes.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3SQo6kBOH4upv1BPEPOvAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFZlqj_tH1dnSpGLpLFHdw.png" /></figure><p><strong>Step-6:</strong> destroy EKS1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cjuJO-e0zmaE_ApPmR56GA.png" /></figure><p><strong>Step-7:</strong> create EKS2 for restore</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zw65h4bkFqR4nT9hPPIRJQ.png" /></figure><ul><li>As seen, my newly created EKS2 Kubernetes cluster does not have any applications or Velero installed. Now, first and foremost, we will install Velero on EKS2 and then proceed to restore from the backup previously created on EKS1 to EKS2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c90B04qX-HEJtJqntR4Xqg.png" /></figure><p><strong>Step-8: </strong>For the EKS2 cluster, we will create an “IAM OIDC provider” and an “Amazon EBS CSI driver IAM role for service accounts.”</p><pre># Creating an IAM OIDC provider for your cluster<br>oidc_id=$(aws eks describe-cluster --name EKS2 --query &quot;cluster.identity.oidc.issuer&quot; --output text | cut -d &#39;/&#39; -f 5)<br>aws iam list-open-id-connect-providers | grep $oidc_id<br>eksctl utils associate-iam-oidc-provider --region=us-east-1 --cluster=EKS2 --approve<br><br># check again<br>aws iam list-open-id-connect-providers | grep $oidc_id<br># output<br>- Arn: arn:aws:iam::xxxxxxxxxx:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/xxxxxxxxxxxxxxxxxxxxxxx</pre><h3>Install Velero to EKS2:</h3><ul><li>Previously, an S3 bucket was already set up for backups, and a policy named “VeleroAccessPolicy” was created for the service account. Now, for the EKS2 cluster, we will only create the service account and proceed to install Velero.</li></ul><p>1- <strong>Create Service Accounts for Velero.</strong></p><pre>RECOVERY_CLUSTER=EKS2<br>ACCOUNT=$(aws sts get-caller-identity --query Account --output text)<br><br>eksctl create iamserviceaccount \<br>    --cluster=$RECOVERY_CLUSTER \<br>    --name=velero-server \<br>    --namespace=velero \<br>    --role-name=eks-velero-recovery \<br>    --role-only \<br>    --attach-policy-arn=arn:aws:iam::$ACCOUNT:policy/VeleroAccessPolicy \<br>    --approve</pre><p>2- <strong>Install Velero in EKS2 Clusters.</strong></p><pre># create values_recovery.yaml file for install velero helm chart<br>cat &gt; values_recovery.yaml &lt;&lt;EOF<br>configuration:<br>  backupStorageLocation:<br>  - bucket: $BUCKET<br>    provider: aws<br>  volumeSnapshotLocation:<br>  - config:<br>      region: $REGION<br>    provider: aws<br>initContainers:<br>- name: velero-plugin-for-aws<br>  image: velero/velero-plugin-for-aws:v1.7.1<br>  volumeMounts:<br>  - mountPath: /target<br>    name: plugins<br>credentials:<br>  useSecret: false<br>serviceAccount:<br>  server:<br>    annotations:<br>      eks.amazonaws.com/role-arn: &quot;arn:aws:iam::${ACCOUNT}:role/eks-velero-recovery&quot;<br>EOF<br><br># install velero to EKS2<br>helm install velero vmware-tanzu/velero \<br>    --create-namespace \<br>    --namespace velero \<br>    -f values_recovery.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61R7JB-fgAfSmcfJXZbtwg.png" /></figure><p><strong>Step-9:</strong> Velero has been installed on EKS2, and as seen above, it can view the backups from EKS1 using the velero get backup command. Now, we will proceed to restore the backup from EKS1 to EKS2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TRSJ33drf8ZwH-WRljMHfw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gsBzGzcY7wGwQL_1Hypw9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tk494Amzq_k1finqWWQ7gA.png" /></figure><p><strong>Step-10:</strong> If we update the previously created A record in the Route 53 service with the DNS name of the newly created load balancer, we will see all traffic directed to the same domain name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z0fvMw6z-OaJhEFOwN3efQ.gif" /></figure><blockquote>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider <strong>following</strong> me and giving the article a <strong>clap</strong>. Your support means a lot and helps me continue creating content that you love.</blockquote><blockquote>Thanks again, and happy reading!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=763910b32fef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-for-aws-eks-763910b32fef">Velero: Kubernetes Backup and Restore Solution for AWS EKS</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Velero: Kubernetes Backup and Restore Solution for Azure AKS]]></title>
            <link>https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-0cbd56f449be?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cbd56f449be</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[azure-aks]]></category>
            <category><![CDATA[velero]]></category>
            <category><![CDATA[velero-backup]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Sun, 02 Jun 2024 22:33:19 GMT</pubDate>
            <atom:updated>2024-07-06T20:01:53.901Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Kubernetes is a powerful platform for managing and deploying applications. However, managing Kubernetes environments requires a robust solution for data protection and backups. This is where Velero comes into play. In this article, we will explore what Velero is, its purpose, and how it can be used.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0vx1It40N8d9Xgs7LIOtw.png" /></figure><h3>What is Velero?</h3><p>Velero (formerly known as Heptio Ark) is an open-source backup, restore, and disaster recovery solution for Kubernetes environments. Velero allows you to back up your Kubernetes cluster resources and persistent volumes, restore them to a specific point in time, and migrate cluster resources across different environments. You can run Velero with a cloud provider or on-premises. Velero lets you:</p><ul><li>Take backups of your cluster and restore in case of loss.</li><li>Migrate cluster resources to other clusters.</li><li>Replicate your production cluster to development and testing clusters.</li></ul><p><strong>Velero consists of:</strong></p><ul><li>A server that runs on your cluster</li><li>A command-line client that runs locally</li></ul><h3>How to Use Velero?</h3><p>Before using Velero, I will show you how to install the Velero CLI tool on your local machine, from where you will manage Kubernetes. After that, depending on your preference, I will demonstrate how to take a backup of your cluster and restore it to another Kubernetes cluster. This can be done either in a cloud environment (AWS EKS, Azure AKS, or GKE) or on a cluster set up with kubeadm.</p><h3>Back up, restore workload clusters using Velero</h3><blockquote>In my next article, I will demonstrate this on AWS EKS and GKE. However, for now, I will show you by setting up two Kubernetes clusters on Azure.</blockquote><p><strong>Step-1:</strong> First, I created an Azure AKS (Azure Kubernetes Service)on Azure and deployed a sample application into it for demonstration purposes. Next, I will install Velero onto this Azure AKS and take its backup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*PaSEHkTDz-M6e_Z_Bf6W3w.png" /></figure><p><strong>Step-2:</strong> First, install Velero cli tool.</p><ul><li><a href="https://velero.io/docs/v1.8/basic-install/">https://velero.io/docs/v1.8/basic-install/</a></li><li><a href="https://github.com/vmware-tanzu/velero/releases/tag/v1.13.2">https://github.com/vmware-tanzu/velero/releases/tag/v1.13.2</a></li></ul><pre>curl -LO https://github.com/vmware-tanzu/velero/releases/download/v1.13.2/velero-v1.13.2-linux-amd64.tar.gz<br>tar zxvf velero-v1.13.2-linux-amd64.tar.gz<br>sudo mv velero-v1.13.2-linux-amd64/velero /usr/local/bin/velero</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeYUpYLvgUpqyCf85eZPUg.png" /></figure><p><strong>Step-3:</strong> Install Velero with Azure Blob Storage</p><ul><li>You can install Velero on Azure AKS by following the instructions in this link.</li><li><a href="https://learn.microsoft.com/en-us/azure/aks/hybrid/backup-workload-cluster">https://learn.microsoft.com/en-us/azure/aks/hybrid/backup-workload-cluster</a></li><li><a href="https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azure#compatibility">https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azure#compatibility</a></li></ul><pre># velidate subscription id<br>export AZURE_SUBSCRIPTION_NAME=&quot;Microsoft Azure Sponsorship&quot;<br>export AZURE_SUBSCRIPTION_ID=$(az account list --query=&quot;[?name==&#39;$AZURE_SUBSCRIPTION_NAME&#39;].id | [0]&quot; -o tsv)<br>az account set -s $AZURE_SUBSCRIPTION_ID<br><br># Create resource group<br>export AZURE_BACKUP_RESOURCE_GROUP=Velero_Backup<br>export LOCATION=eastus2<br>az group create -n $AZURE_BACKUP_RESOURCE_GROUP --location $LOCATION<br><br># Create the storage account<br>export AZURE_STORAGE_ACCOUNT_ID=&quot;veleromkanus&quot;<br>az storage account create \<br>    --name $AZURE_STORAGE_ACCOUNT_ID \<br>    --resource-group $AZURE_BACKUP_RESOURCE_GROUP \<br>    --sku Standard_GRS \<br>    --encryption-services blob \<br>    --https-only true \<br>    --min-tls-version TLS1_2 \<br>    --kind BlobStorage \<br>    --access-tier Hot<br><br># Create a blob container<br>export BLOB_CONTAINER=&quot;veleromkanus&quot;<br>az storage container create -n $BLOB_CONTAINER --public-access off --account-name $AZURE_STORAGE_ACCOUNT_ID<br><br># set the resource_group with azure aks containing MC letters<br># WARNING: If you&#39;re using AKS, AZURE_RESOURCE_GROUP must be set to the name of the auto-generated resource group that is created when you provision your cluster in Azure, since this is the resource group that contains your cluster&#39;s virtual machines/disks.<br>export AZURE_RESOURCE_GROUP=MC_rg-AKS1_AKS1_eastus2<br><br># Create a service principal that has Contributor privileges<br>export SP_NAME=veleromkanus<br>az ad sp create-for-rbac --name $SP_NAME --role contributor \<br>                                --scopes /subscriptions/$AZURE_SUBSCRIPTION_ID \<br>                                --json-auth<br><br># After creating the service principal, obtain the client id.<br># NOTE: Ensure that value for --name does not conflict with other service principals/app registrations.<br>export AZURE_CLIENT_ID=`az ad sp list --display-name &quot;$SP_NAME&quot; --query &#39;[0].appId&#39; -o tsv`<br><br># After creating the service principal, obtain the client id.<br>export AZURE_CLIENT_ID=`az ad sp list --display-name &quot;$SP_NAME&quot; --query &#39;[0].appId&#39; -o tsv`<br><br># (Optional)Assign additional permissions to the service principal (For useAAD=true with built-in role)<br>az role assignment create --assignee $AZURE_CLIENT_ID --role &quot;Storage Blob Data Contributor&quot; --scope /subscriptions/$AZURE_SUBSCRIPTION_ID<br><br># Create a file that contains the variables the Velero installation requires. The command looks similar to the following one<br># Important: Delete this file after you install Velero. The client secret is in plaintext, which can pose a security risk.<br>cat &lt;&lt; EOF  &gt; ./credentials-velero.txt<br>AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID}<br>AZURE_TENANT_ID=${AZURE_TENANT_ID}<br>AZURE_CLIENT_ID=${AZURE_CLIENT_ID}<br>AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET}<br>AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP}<br>AZURE_CLOUD_NAME=AzurePublicCloud<br>EOF<br><br># Install Velero on the cluster, and start the deployment.<br># This procedure creates a namespace called velero and adds a deployment named velero to the namespace.<br># Install Velero using the following command.<br># You&#39;ll need to customize the example command.<br>velero install --provider azure \<br>        --plugins velero/velero-plugin-for-microsoft-azure:v1.5.0 \<br>        --bucket $BLOB_CONTAINER \<br>        --secret-file ./credentials-velero.txt \<br>        --backup-location-config resourceGroup=$AZURE_BACKUP_RESOURCE_GROUP,storageAccount=$AZURE_STORAGE_ACCOUNT_ID,subscriptionId=$AZURE_SUBSCRIPTION_ID \<br>        --use-node-agent \<br>        --uploader-type restic</pre><p><strong>Step-4:</strong> You can verify that all commands have been applied by checking the command output or the logs for any error messages or indications of successful execution. Additionally, you can use commands like kubectl get all -n velero to see if the Velero components have been deployed successfully and are running as expected on your Azure AKS cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ty9YXnpRnYUGC4xpjbZNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qitah0sPDVaXyZZnGD5-EA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jazRjbP3TR7tkAHsPOYZHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*yzvgzDLiI364TuP5ylKLQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*0ubcFUhvYa6JzQjVbdB4Qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qG9eev2gxXH75X7pWzzLbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEDXy6ZGrCRv_Sf3CihP2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQ2d10whnGTvDGn_zJQVHQ.png" /></figure><ul><li>You can see the Velero commands from the link below.</li><li><a href="https://github.com/mutazn/Backup-and-Restore-AKS-cluster-using-Velero">https://github.com/mutazn/Backup-and-Restore-AKS-cluster-using-Velero</a></li></ul><blockquote><strong>So far, we have created an AKS1 Kubernetes cluster on Azure, deployed a sample application with PV and PVC, and finally installed Velero to take a backup of this cluster.</strong></blockquote><p><strong>Step-5:</strong> At this stage, assuming that some namespaces of the AKS1 Kubernetes cluster have been deleted or the entire cluster has crashed for any reason, we will see how to restore the backup of the AKS1 Kubernetes cluster to a newly created AKS2 Kubernetes cluster.</p><ul><li>For this, we will create another Azure AKS named <strong>AKS2</strong> on Azure.</li><li>As seen, Velero is not yet installed on the <strong>AKS2 Kubernetes cluster</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*NNjHncGbTILjMeE6cN0NjQ.png" /></figure><p><strong>Step-6:</strong> Now, we will install Velero on it using the following steps on the <strong>AKS2 Kubernetes cluster</strong>.</p><pre>#Save Velero credentials to local file.<br>cat &lt;&lt; EOF  &gt; ./credentials-velero.txt<br>AZURE_SUBSCRIPTION_ID=&quot;${SUBSCRIPTION_ID}&quot;<br>AZURE_TENANT_ID=&quot;${TENANT_ID}&quot;<br>AZURE_CLIENT_ID=&quot;${AZURE_CLIENT_ID}&quot;<br>AZURE_CLIENT_SECRET=&quot;${AZURE_CLIENT_SECRET}&quot;<br>AZURE_RESOURCE_GROUP=&quot;${TARGET_AKS_INFRASTRUCTURE_RESOURCE_GROUP}&quot;<br>AZURE_CLOUD_NAME=AzurePublicCloud<br>EOF<br><br># Install Velero on the cluster, and start the deployment.<br># This procedure creates a namespace called velero and adds a deployment named velero to the namespace.<br># Install Velero using the following command.<br># You&#39;ll need to customize the example command.<br>velero install --provider azure \<br>        --plugins velero/velero-plugin-for-microsoft-azure:v1.5.0 \<br>        --bucket $BLOB_CONTAINER \<br>        --secret-file ./credentials-velero.txt \<br>        --backup-location-config resourceGroup=$AZURE_BACKUP_RESOURCE_GROUP,storageAccount=$AZURE_STORAGE_ACCOUNT_ID,subscriptionId=$AZURE_SUBSCRIPTION_ID \<br>        --use-node-agent \<br>        --uploader-type restic</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhFvHcbjP97scqI9dDp1UA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4_IAIrhOOto_vAv1f8Z-A.png" /></figure><p><strong>The last step: </strong>Now, let’s restore the backup from AKS1 to AKS2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPZqbI9GPWn8tIynjyKDGw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fOG7EJsG-jtDcI-FesOfkA.gif" /></figure><blockquote>“In conclusion, Velero provides a robust solution for backing up and restoring Kubernetes clusters, ensuring data integrity and business continuity in case of unexpected failures or migrations.”</blockquote><p>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider <strong>following</strong> me and giving the article a <strong>clap</strong>. Your support means a lot and helps me continue creating content that you love.</p><p>Thanks again, and happy reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cbd56f449be" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/velero-kubernetes-backup-and-restore-solution-0cbd56f449be">Velero: Kubernetes Backup and Restore Solution for Azure AKS</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[kube-bench: Enhancing Kubernetes Security-1]]></title>
            <link>https://medium.com/hedgus/comprehensive-guide-to-kube-bench-enhancing-kubernetes-security-1-988ac050598c?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/988ac050598c</guid>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Thu, 23 May 2024 15:13:23 GMT</pubDate>
            <atom:updated>2024-06-09T07:55:58.702Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction to kube-bench</strong></h3><blockquote>In the world of container orchestration, Kubernetes stands out as the most popular platform, automating the deployment, scaling, and management of containerized applications. However, with its widespread adoption, ensuring the security of Kubernetes clusters has become paramount. This is where kube-bench comes into play.</blockquote><blockquote>kube-bench is an open-source tool designed to check whether Kubernetes is deployed securely by running the checks documented in the <a href="https://www.cisecurity.org/benchmark/kubernetes"><strong>CIS Kubernetes Benchmark</strong></a><strong>.</strong> The Center for Internet Security (CIS) provides a set of best practices and guidelines for securing Kubernetes clusters, and kube-bench automates the process of auditing your clusters against these standards.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*290iO1MD2AbCnPMxR13Bxg.png" /></figure><h3>What is kube-bench Used For?</h3><p><a href="https://www.cisecurity.org/benchmark/kubernetes">kube-bench</a> is primarily used for:</p><ul><li><strong>Security Audits:</strong> It performs security checks to ensure compliance with the CIS Kubernetes Benchmark.</li><li><strong>Automated Security Assessments:</strong> Regularly running kube-bench can help in identifying security misconfigurations and vulnerabilities in your Kubernetes clusters.</li><li><strong>Compliance Reporting:</strong> It provides detailed reports on the compliance status, helping organizations to meet regulatory and internal security requirements.</li></ul><h3>Installing kube-bench</h3><p>You can install kube-bench on any Kubernetes environment, whether it’s provided by a cloud provider (AWS EKS, Azure AKS, GKS, etc.) or created using kubeadm.</p><p><strong>Step-1: </strong>I will start by setting up two virtual machines on Azure and install kubeadm on them to create a Kubernetes cluster. You can create your Kubernetes cluster in any way you prefer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rIEOceCDq-8WNTi_G38f1A.png" /></figure><p><strong>Step-2: </strong>As you can see, a Kubernetes cluster created with kubeadm is ready. Now, I will deploy a sample application into the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHCYs6Hr2xPtFGOFRETiEA.png" /></figure><p><strong>Step-3:</strong> Securing Kubernetes clusters is a critical task for ensuring the safety and integrity of containerized applications. The <a href="https://www.cisecurity.org/benchmark/kubernetes"><strong>CIS Kubernetes Benchmark</strong></a> provides a comprehensive set of best practices and guidelines aimed at securing Kubernetes environments. This benchmark is widely recognized and utilized to audit Kubernetes clusters, highlighting key areas where security improvements can be made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcsPRGkbmcJSK9tqMc1Uew.png" /></figure><ul><li>After registering, upon confirming the verification link sent to your email, you can download the “CIS Kubernetes Benchmark v1.9.0–03–25–2024” source in PDF format. By referring to the table of contents, you’ll notice that each item serves as a security checklist for your cluster.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECn4qiYA3lTaRTbiuuP2Cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tiDvf5sJqa_p5bG-6A86BQ.gif" /></figure><p><strong>Step-4:</strong> When you visit the <a href="https://github.com/aquasecurity/kube-bench?tab=readme-ov-file">https://github.com/aquasecurity/kube-bench?tab=readme-ov-file</a> link, you will find a manifest file that you can use to deploy kube-bench to your cluster. After installing this file on your cluster, you can view all security vulnerabilities of your entire Kubernetes cluster from the logs of the pod that is created. All FAIL statuses mentioned there will either direct you to the cause and solution of the error from the PDF documentation I provided you above, or clicking on the error will redirect you to a link that explains the cause and solution. There, you can address the security vulnerabilities in your Kubernetes cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BGREgGgntsl5aDTQT_TKnA.gif" /></figure><pre>$ kubectl apply -f job.yaml<br>job.batch/kube-bench created<br><br>$ kubectl get pods<br>NAME                      READY   STATUS              RESTARTS   AGE<br>kube-bench-j76s9   0/1     ContainerCreating   0          3s<br><br># Wait for a few seconds for the job to complete<br>$ kubectl get pods<br>NAME                      READY   STATUS      RESTARTS   AGE<br>kube-bench-j76s9   0/1     Completed   0          11s<br><br># The results are held in the pod&#39;s logs<br>kubectl logs kube-bench-j76s9<br>[INFO] 1 Master Node Security Configuration<br>[INFO] 1.1 API Server<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKMPTmYg-PMXATvs38BXxQ.png" /></figure><ul><li>When we examine the logs of the kube-bench pod above, we can see the security vulnerabilities that are FAIL within the Kubernetes cluster.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4Tej2_YoANyJIAiw4EgBg.gif" /></figure><blockquote>Now, you can correct the processes that have FAILED from the kube-bench pod logs by referring to the “CIS BENCHMARK” PDF documentation you downloaded earlier.</blockquote><ul><li><strong><em>[FAIL] 4.1.1 Ensure that the kubelet service file permissions are set to 600 or more restrictive (Automated)</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GopfOSPQvaL3CK-JzZE95Q.gif" /></figure><p><strong><em>[FAIL] 4.1.9 If the kubelet config.yaml configuration file is being used validate permissions set to 600 or more restrictive (Automated)</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKTS7MXDCqVNTs0kWim-Eg.gif" /></figure><h3>Conclusion</h3><p>In conclusion, kube-bench is an essential tool for any Kubernetes administrator aiming to enhance their cluster’s security. By automating the checks defined in the CIS Kubernetes Benchmark, kube-bench provides a comprehensive assessment of your cluster’s security posture. Regularly running kube-bench helps identify potential vulnerabilities and ensures compliance with industry best practices. By addressing the FAILED checks through the detailed guidance provided in the CIS Benchmark documentation, you can significantly strengthen your Kubernetes environment, mitigating risks and safeguarding your containerized applications. Implementing kube-bench as part of your security strategy not only promotes a robust security framework but also fosters confidence in the reliability and safety of your Kubernetes deployments.</p><blockquote>For now, I have completed and presented my first article on maintaining and enhancing the security of a Kubernetes cluster. In my upcoming articles, I will cover two more security tools: Trivy and Kubescape. Please like and share my article!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=988ac050598c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/comprehensive-guide-to-kube-bench-enhancing-kubernetes-security-1-988ac050598c">kube-bench: Enhancing Kubernetes Security-1</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Cybersecurity with MISP: Complete Ubuntu Installation, SSL Certification, and Event…]]></title>
            <link>https://medium.com/hedgus/enhancing-cybersecurity-with-misp-complete-ubuntu-installation-ssl-certification-and-event-d9284b928596?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9284b928596</guid>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Fri, 17 May 2024 22:15:40 GMT</pubDate>
            <atom:updated>2024-05-18T11:36:02.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enhancing Cybersecurity with MISP: Complete Ubuntu Installation, SSL Certification, and Event Loading Guide</h3><h3>Introduction</h3><p>In the ever-evolving landscape of cybersecurity, sharing threat intelligence is paramount. The Malware Information Sharing Platform &amp; Threat Sharing (MISP) is an open-source tool designed to facilitate the sharing of structured threat information. In this guide, we’ll delve into MISP’s purpose, its key functionalities, and provide a step-by-step tutorial on installing MISP on an Ubuntu machine along with all necessary components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODPDIV6xxKa56esZkFkIEg.png" /></figure><h3>What is MISP?</h3><p>MISP is a powerful platform used by organizations worldwide to collect, store, and share cybersecurity threat information. Its primary purposes include:</p><ul><li><strong>Centralizing Threat Data:</strong> Aggregates data from various sources into a single platform.</li><li><strong>Enhancing Collaboration:</strong> Facilitates the exchange of threat intelligence among trusted partners.</li><li><strong>Automating Threat Response:</strong> Integrates with other security tools to automate threat detection and response.</li></ul><h3>Key Functionalities</h3><ol><li><strong>Data Collection and Storage:</strong> MISP allows users to collect and store threat information such as indicators of compromise (IOCs), vulnerability data, and attack patterns.</li><li><strong>Data Correlation:</strong> Automatically correlates new data with existing information to identify patterns and potential threats.</li><li><strong>Sharing and Collaboration:</strong> Enables secure sharing of threat intelligence with other organizations or within a community.</li><li><strong>API Access:</strong> Provides RESTful API access for automation and integration with other security tools.</li><li><strong>Customization and Extensibility:</strong> Supports customization through modules and extensions to fit specific organizational needs.</li></ol><h3>Prerequisites</h3><p>Before starting the installation, ensure you have the following:</p><ul><li>An Ubuntu 20.04 LTS or later machine on any cloud provider</li><li>Installation instructions from the official documentation page</li><li>SSL-certified setup with Nginx, Apache, etc.</li><li>Registering the domain name with a DNS provider</li></ul><p><strong>Step-1: </strong>Let’s start by spinning up an Ubuntu machine on any cloud provider. I’m deploying this machine on Azure.</p><ul><li>After connecting to the Ubuntu machine via SSH, let’s execute the following commands sequentially to complete the installation of MISP.</li><li>You can perform the installation of MISP from the following link. <a href="https://misp.github.io/MISP/INSTALL.ubuntu2004">https://misp.github.io/MISP/INSTALL.ubuntu2004</a></li></ul><pre>sudo apt-get update &amp;&amp; sudo apt-get upgrade<br><br>wget --no-cache -O /tmp/INSTALL.sh https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh<br>bash /tmp/INSTALL.sh</pre><ul><li>In the first command, after updating the Ubuntu machine, the second command will use wget to download the INSTALL.sh script installation file to the /tmp directory. We can update the relevant section in the INSTALL.sh file for the subsequent Apache2 SSL installation before proceeding with the installation.</li><li>In the third command, the installation options for MISP are displayed. I will install all plugins along with it using the -A flag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sF3c7ubxUvMt845aMBBlPQ.png" /></figure><ul><li>As I mentioned, I’m executing the INSTALL.sh command with the -A flag as follows</li></ul><pre>bash /tmp/INSTALL.sh -A</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KI8VnmTSLLsPom2iGBAJTg.png" /></figure><ul><li>We can observe that MariaDB and Apache2 are installed along with the installation of MISP.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*tX9q_nH2MCLBjsBwYAt-Hg.png" /></figure><p><strong>Step-2:</strong> We can access MISP from a browser using the localhost or the public IP address of the Ubuntu machine. After connecting to MISP, we can change the default password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPuXjxX1Vfbimf_YGTamJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YH0OhNQYja909AT-NgLtkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*74c-EpQInoH4zIidHjvc7Q.png" /></figure><p><strong>Step-3:</strong> Now, instead of accessing it with the machine’s public IP, let’s link it to a domain name with an SSL certificate. Let’s create an SSL certificate for MISP from the following link.</p><p><a href="https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04">https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04</a></p><pre># Step 1 — Installing Certbot<br>sudo apt install certbot python3-certbot-apache<br><br># Step 2 — Checking your Apache Virtual Host Configuration<br>sudo nano /etc/apache2/sites-available/your_domain.conf<br>sudo apache2ctl configtest<br>sudo systemctl reload apache2<br><br># Step 3 — Allowing HTTPS Through the Firewall<br>sudo ufw status<br>sudo ufw allow &#39;Apache Full&#39;<br>sudo ufw delete allow &#39;Apache&#39;<br><br># Step 4 — Obtaining an SSL Certificate<br>sudo certbot --apache<br><br># Step 5 — Verifying Certbot Auto-Renewal<br>sudo systemctl status certbot.timer<br>sudo certbot renew --dry-run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0alPqmJB42TlkO4OOAD4GA.png" /></figure><p><strong>Step-4: </strong>After completing the installation of Apache2 with SSL using Let’s Encrypt, create an A record with the server’s public IP address at your DNS provider. I will create my DNS record in AWS Route 53.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzTcz4pZR6PxgP82r2irlA.png" /></figure><ul><li>Now I can securely connect to the MISP interface using HTTPS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RaiPGeIk1Y62mRdY_hicQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x96KdXeBtePBIqDbBWc62g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85p2QA2ojWtUsRiJ8SFVrw.png" /></figure><p><strong>Step-5:</strong> We can download the feeds in JSON format from the following link. <a href="https://github.com/MISP/MISP/blob/2.4/app/files/feed-metadata/defaults.json">https://github.com/MISP/MISP/blob/2.4/app/files/feed-metadata/defaults.json</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUh0wNITpn6RTnW35Xvl1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeWhWZ69PVA7GWUQM8J3sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7SWGNU7N13OjJcfa8x5mg.png" /></figure><h3>Conclusion: Automated Threat Intelligence Feeds</h3><p>MISP (Malware Information Sharing Platform) is a powerful tool designed for the efficient sharing and analysis of threat intelligence. It serves as a crucial resource for organizations to collaborate and enhance their security posture by sharing information on malware, vulnerabilities, and other cyber threats. The primary purpose of downloading feeds in JSON format is to import structured threat data into MISP, enabling users to stay updated with the latest intelligence and incorporate it into their security operations. These feeds can be leveraged in various scenarios, including incident response, threat detection, and proactive defense strategies. Additionally, MISP provides the flexibility to automate the feed download process using scheduled jobs, ensuring that the platform remains populated with the most current data without manual intervention. By integrating these feeds, organizations can bolster their threat intelligence capabilities and improve their overall cybersecurity resilience.</p><blockquote>If you found this article helpful, please consider following me for more insights on cybersecurity and threat intelligence. Don’t forget to like and share this article to help others discover the benefits of MISP. Your support is greatly appreciated!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9284b928596" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/enhancing-cybersecurity-with-misp-complete-ubuntu-installation-ssl-certification-and-event-d9284b928596">Enhancing Cybersecurity with MISP: Complete Ubuntu Installation, SSL Certification, and Event…</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Key Vault provider for Secrets Store CSI Driver in an Azure Kubernetes Service (AKS)]]></title>
            <link>https://medium.com/hedgus/azure-key-vault-provider-for-secrets-store-csi-driver-in-an-azure-kubernetes-service-aks-56de3fe6c9b4?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/56de3fe6c9b4</guid>
            <category><![CDATA[key-vault-secret]]></category>
            <category><![CDATA[keyvault]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Tue, 26 Mar 2024 14:31:10 GMT</pubDate>
            <atom:updated>2024-07-06T20:02:31.839Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Azure Key Vault, a service offered by Azure for securely storing and managing sensitive data, is pivotal in cloud environments like Azure Kubernetes Service (AKS) where applications require secure access to sensitive information. To address this need, an tool named Secrets Store CSI Driver facilitates access to sensitive data stored in Azure Key Vault for containerized applications running on AKS clusters. This article will delve into how Azure Key Vault provider for Secrets Store CSI Driver is utilized in AKS clusters, the security measures it provides, and the advantages it offers for applications.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*0uUYY3Vs2Pxf4ThY.png" /></figure><h3><strong>Security measures provided:</strong></h3><p><strong>Centralized management of sensitive data:</strong> Azure Key Vault enables centralized management of sensitive data, ensuring that data is accessed and managed from a single trusted source, thus meeting security and compliance requirements.</p><p><strong>Data encryption:</strong> Azure Key Vault encrypts data at rest, ensuring access control and protection against unauthorized access.</p><p><strong>Access controls and monitoring:</strong> Azure Key Vault provides access controls and monitoring capabilities, allowing tracking and auditing of which users or applications can access which data.</p><h3><strong>Advantages for applications:</strong></h3><p><strong>Secure data storage and access:</strong> Azure Key Vault Provider for Secrets Store CSI Driver facilitates secure access to sensitive data for applications, thereby enhancing data security.</p><p><strong>Easy integration:</strong> This solution enables seamless integration of applications running on AKS clusters with Azure Key Vault, reducing concerns for application developers regarding data security.</p><p><strong>Ensuring compliance:</strong> Azure Key Vault complies with numerous compliance standards and fulfills data security requirements, assisting applications in meeting compliance requirements.</p><p>Azure Key Vault Provider for Secrets Store CSI Driver provides a robust tool for secure data management in AKS clusters, assisting applications in meeting their data security requirements. This allows both developers and business owners to focus on data security.</p><blockquote>You can review the link for Azure Key Vault basic concepts at <a href="https://learn.microsoft.com/en-us/azure/key-vault/general/basic-concepts">https://learn.microsoft.com/en-us/azure/key-vault/general/basic-concepts</a>, and the link for Azure security baseline for Key Vault at <a href="https://learn.microsoft.com/en-us/security/benchmark/azure/baselines/key-vault-security-baseline">https://learn.microsoft.com/en-us/security/benchmark/azure/baselines/key-vault-security-baseline</a>.</blockquote><p>In this article, we’ll discuss how to securely use sensitive information stored in Azure Key Vault within your Azure Kubernetes Cluster (AKS). Specifically, we’ll explore how to store sensitive data like database usernames and passwords in Azure Key Vault and securely utilize them in the AKS environment. We’ll cover the best practices for accomplishing this task and address potential challenges that may arise during implementation. Additionally, we’ll delve into the Secret Store CSI Driver, a critical component in this process, enabling you to store your sensitive information securely and utilize it as environment variables in AKS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFVdFuhf6eMeNPxFxR8MGA.png" /></figure><p>By leveraging Azure Key Vault and the Secret Store CSI Driver, you can ensure the confidentiality and security of your application’s sensitive data while seamlessly integrating it into your AKS environment. This approach provides a robust solution for managing secrets, enhancing the overall security posture of your Kubernetes-based applications.</p><p>Let’s get started.</p><p><strong>Step-1:</strong> <a href="https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-driver#enable-and-disable-autorotation">Create an AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver support.</a></p><p><strong>Note:</strong> If you want to use Microsoft Entra Workload ID, you must also use the --enable-oidc-issuer and --enable-workload-identity parameters</p><pre>az group create -n key-vault -l eastus<br>az aks create -n AKS-Cluster -g key-vault --enable-addons azure-keyvault-secrets-provider --enable-oidc-issuer --enable-workload-identity</pre><p><strong>Note:</strong> If you have previously created the cluster without the following addons and other parameters, the cluster and addons can still be updated using the commands below.</p><pre>--addons azure-keyvault-secrets-provider # for Secrets Store CSI Driver support<br><br>--enable-oidc-issuer # Used to enable OIDC (OpenID Connect) issuer in Azure AKS.<br>--enable-workload-identity # Used to enable workload identities in Azure AKS.<br>--enable-secret-rotation # Used to enable automatic secret rotation in Azure AKS.</pre><ul><li>The updating of the cluster and addons with the aforementioned parameters. Remember, if these were not present in your previous cluster, execute these commands.</li></ul><pre>az aks enable-addons --addons azure-keyvault-secrets-provider --name AKS-Cluster --resource-group key-vault<br>az aks update --name AKS-Cluster --resource-group key-vault --enable-oidc-issuer --enable-workload-identity --enable-secret-rotation</pre><ul><li>Verify the Azure Key Vault provider for Secrets Store CSI Driver installation.</li></ul><pre>kubectl get pods -n kube-system -l &#39;app in (secrets-store-csi-driver,secrets-store-provider-azure)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9H3lK0_yEu-KCNay3tkGUQ.png" /></figure><p><strong>Step-2:</strong> <a href="https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-driver#enable-and-disable-autorotation"><strong>Create or use an existing Azure Key Vault</strong></a><strong>:</strong> Create a <strong>key vault</strong> with Azure <strong>role-based access control</strong> <strong>(Azure RBAC)</strong>. The name of the <strong>Key Vault</strong> you want to create must be <strong>unique</strong>.</p><pre>az keyvault create -n mk-keyvault -g key-vault -l eastus --enable-rbac-authorization</pre><p><strong>Step-3:</strong> Connect your Azure identity provider to the Azure Key Vault Secrets Store CSI Driver in Azure Kubernetes Service (AKS).</p><p>Configure workload identity</p><p><strong>1-</strong> Configure workload identity</p><pre>export SUBSCRIPTION_ID=ddf05ef9-...................<br>export RESOURCE_GROUP=key-vault<br>export UAMI=azurekeyvaultsecretsprovider-aks-cluster<br>export KEYVAULT_NAME=mk-keyvault<br>export CLUSTER_NAME=AKS-Cluster<br><br>az account set --subscription $SUBSCRIPTION_ID</pre><p><strong>2-</strong> Create a managed identity using the <a href="https://learn.microsoft.com/en-us/cli/azure/identity#az-identity-create">az identity create</a> command.</p><pre>az identity create --name $UAMI --resource-group $RESOURCE_GROUP<br><br>export USER_ASSIGNED_CLIENT_ID=&quot;$(az identity show -g $RESOURCE_GROUP --name $UAMI --query &#39;clientId&#39; -o tsv)&quot;<br>export IDENTITY_TENANT=$(az aks show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --query identity.tenantId -o tsv)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*YUjgQ2xaEvGc1T67CzYNpg.png" /></figure><p><strong>3-</strong> Create a role assignment that grants the workload identity permission to access the key vault secrets, access keys, and certificates using the <a href="https://learn.microsoft.com/en-us/cli/azure/role/assignment#az-role-assignment-create">az role assignment create</a> command.</p><pre>export KEYVAULT_SCOPE=$(az keyvault show --name $KEYVAULT_NAME --query id -o tsv)<br><br>az role assignment create --role &quot;Key Vault Administrator&quot; --assignee $USER_ASSIGNED_CLIENT_ID --scope $KEYVAULT_SCOPE</pre><ul><li>Let’s check role assignment..</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ms6Z3ZqO5NVgyQ9D-1Agcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebec7Ve-WJDwu4Zdn5HIpg.png" /></figure><p><strong>4-</strong> Get the AKS cluster OIDC Issuer URL using the <a href="https://learn.microsoft.com/en-us/cli/azure/aks#az-aks-show">az aks show</a> command.</p><pre>export AKS_OIDC_ISSUER=&quot;$(az aks show --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --query &quot;oidcIssuerProfile.issuerUrl&quot; -o tsv)&quot;<br>echo $AKS_OIDC_ISSUER</pre><p><strong>5-</strong> Get the object ID of the Microsoft Entra application using the following commands. Make sure to update the values for serviceAccountName and serviceAccountNamespace with the Kubernetes service account name and its namespace.</p><pre>export SERVICE_ACCOUNT_NAME=&quot;workload-identity-sa&quot;  # sample name; can be changed<br>export SERVICE_ACCOUNT_NAMESPACE=&quot;default&quot; # can be changed to namespace of your workload<br><br>cat &lt;&lt;EOF | kubectl apply -f -<br>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br>  annotations:<br>    azure.workload.identity/client-id: ${USER_ASSIGNED_CLIENT_ID}<br>  name: ${SERVICE_ACCOUNT_NAME}<br>  namespace: ${SERVICE_ACCOUNT_NAMESPACE}<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*tyWkGrur-Vwst0wQ_cFM2Q.png" /></figure><p><strong>6-</strong> Create the federated identity credential between the managed identity, service account issuer, and subject using the <a href="https://learn.microsoft.com/en-us/cli/azure/identity/federated-credential#az-identity-federated-credential-create">az identity federated-credential create</a> command.</p><pre>export FEDERATED_IDENTITY_NAME=&quot;aksfederatedidentity&quot; # can be changed as needed<br><br>az identity federated-credential create --name $FEDERATED_IDENTITY_NAME --identity-name $UAMI --resource-group $RESOURCE_GROUP --issuer ${AKS_OIDC_ISSUER} --subject system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}</pre><blockquote><strong>Important Note:</strong> You need to assign users the “Key Vault Administrator” role for the Key Vault you’ve created under the same subscription. Otherwise, you won’t have the permission to create “key”, “secret”, and “certificates” objects.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_F8JLjORqdqYph2vWm2BSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xw_G05JR6H41Q07HGUaMHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3HZ87QPGiT4xK6CxAVA5g.png" /></figure><ul><li>Before assigning the role to the user,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1yHOmgt8ryYvjLkuZ36zmQ.png" /></figure><ul><li>After the role has been assigned to the user,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imKScpwHLdXFA_i7pWXtOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbuvhFZVfXTbZPtaaBZcMQ.png" /></figure><ul><li>Before creating SecretProviderClass and pods, let’s create secrets for a sample database from the portal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GIqEijCBE335rc0kGU_f7Q.png" /></figure><p><strong>Step-7:</strong> Deploy a SecretProviderClass using the kubectl apply command and the following YAML script.</p><pre>cat &lt;&lt;EOF | kubectl apply -f -<br># This is a SecretProviderClass example using workload identity to access your key vault<br>apiVersion: secrets-store.csi.x-k8s.io/v1<br>kind: SecretProviderClass<br>metadata:<br>  name: azure-kvname-wi # needs to be unique per namespace<br>spec:<br>  provider: azure<br>  parameters:<br>    usePodIdentity: &quot;false&quot;<br>    clientID: &quot;${USER_ASSIGNED_CLIENT_ID}&quot; # Setting this to use workload identity<br>    keyvaultName: ${KEYVAULT_NAME}       # Set to the name of your key vault<br>    cloudName: &quot;&quot;                         # [OPTIONAL for Azure] if not provided, the Azure environment defaults to AzurePublicCloud<br>    objects:  |<br>      array:<br>        - |<br>          objectName: username            # Set to the name of your secret<br>          objectType: secret              # object types: secret, key, or cert<br>          objectVersion: &quot;&quot;               # [OPTIONAL] object versions, default to latest if empty<br>        - |<br>          objectName: password               # Set to the name of your key<br>          objectType: secret<br>          objectVersion: &quot;&quot;<br>    tenantId: &quot;${IDENTITY_TENANT}&quot;        # The tenant ID of the key vault<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*vXj9hNxwQohZ0ryk1f7uBA.png" /></figure><p><strong>Step-8:</strong> Deploy a sample pod using the kubectl apply command and the following YAML script.</p><pre>cat &lt;&lt;EOF | kubectl apply -f -<br># This is a sample pod definition for using SecretProviderClass and workload identity to access your key vault<br>kind: Pod<br>apiVersion: v1<br>metadata:<br>  name: busybox-secrets-store-inline-wi<br>  labels:<br>    azure.workload.identity/use: &quot;true&quot;<br>spec:<br>  serviceAccountName: &quot;workload-identity-sa&quot;<br>  containers:<br>    - name: busybox<br>      image: registry.k8s.io/e2e-test-images/busybox:1.29-4<br>      command:<br>        - &quot;/bin/sleep&quot;<br>        - &quot;10000&quot;<br>      volumeMounts:<br>      - name: secrets-store01-inline<br>        mountPath: &quot;/mnt/secrets-store&quot;<br>        readOnly: true<br>  volumes:<br>    - name: secrets-store01-inline<br>      csi:<br>        driver: secrets-store.csi.k8s.io<br>        readOnly: true<br>        volumeAttributes:<br>          secretProviderClass: &quot;azure-kvname-wi&quot;<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DeIB9jmYufgqm84C0gEN4A.png" /></figure><ul><li>Validate Key Vault secrets.</li></ul><pre>kubectl exec busybox-secrets-store-inline-wi -- ls /mnt/secrets-store/<br>kubectl exec busybox-secrets-store-inline-wi -- cat /mnt/secrets-store/username<br>kubectl exec busybox-secrets-store-inline-wi -- cat /mnt/secrets-store/password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*Tk6QxXpAWEXsrR0sr5HHqQ.png" /></figure><h3><strong>How to load secrets in to environment variable on POD</strong></h3><blockquote>To use these secrets as environment variables inside the pod, we will add the following blocks to the SecretProviderClass and pod YAML files. Then let’s deploy the yaml files.</blockquote><pre># secretproviderclass.yaml (secretObjects block.)<br>...<br>spec:<br>  provider: azure<br>  secretObjects:<br>  - data:<br>    - key: username<br>      objectName: username<br>    secretName: username<br>    type: Opaque<br>  - data:<br>    - key: password<br>      objectName: password<br>    secretName: password<br>    type: Opaque <br>...</pre><pre>pod.yaml (env block)<br>...<br>spec:<br>  serviceAccountName: &quot;workload-identity-sa&quot;<br>  containers:<br>    ...<br>      env:<br>      - name: DB_USER_NAME<br>        valueFrom:<br>          secretKeyRef:<br>            name: username<br>            key: username<br>      - name: DB_PASSWORD<br>        valueFrom:<br>          secretKeyRef:<br>            name: password<br>            key: password<br> ...</pre><ul><li>With the following commands, we can verify that the secrets are embedded as environmental variables within the pod.</li></ul><pre>k exec busybox-secrets-store-inline-wi -- env | grep DB_USER_NAME<br>k exec busybox-secrets-store-inline-wi -- env | grep DB_PASSWORD<br>k describe po busybox-secrets-store-inline-wi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7viYSjxQuZ8EXso-3pojg.png" /></figure><ul><li>Don’t forget to delete all resources.</li></ul><pre>az group delete -n key-vault<br>az group delete -n MC_key-vault_AKS-Cluster_eastus</pre><ul><li>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider <strong>following</strong> me and giving the article a <strong>clap</strong>. Your support means a lot and helps me continue creating content that you love.</li><li>Thanks again, and happy reading!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56de3fe6c9b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/azure-key-vault-provider-for-secrets-store-csi-driver-in-an-azure-kubernetes-service-aks-56de3fe6c9b4">Azure Key Vault provider for Secrets Store CSI Driver in an Azure Kubernetes Service (AKS)</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Istio Tutorial (Ingress Gateway — Virtual Service — Gateway — Ingress — mTLS)]]></title>
            <link>https://medium.com/hedgus/istio-tutorial-ingress-gateway-virtual-service-gateway-ingress-mtls-2bcefe6f4e86?source=rss-8f06d8dffb1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bcefe6f4e86</guid>
            <category><![CDATA[istio-service-tutorial]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[istio-ingress]]></category>
            <dc:creator><![CDATA[Mehmet kanus]]></dc:creator>
            <pubDate>Fri, 08 Mar 2024 21:19:00 GMT</pubDate>
            <atom:updated>2024-07-06T20:00:31.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>Istio Tutorial (Ingress Gateway — Virtual Service — Gateway — Ingress — mTLS)</h3><h3>Introduction to Istio Ingress</h3><p>Istio, an open-source service mesh widely embraced for overseeing and safeguarding communication within services and at the edge, relies on the Envoy proxy for its data plane. This proxy is adept at managing service-to-service communication, supporting both L3/L4 and L7 layers. Notably, the same proxy is employed for Istio Ingress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTjIBrY4-lJFxvc46wB2Og.png" /></figure><p>When it comes to handling and securing traffic in cloud-native applications, Istio Ingress (or Istio Ingress Gateway) and Istio Gateway can seamlessly function at both L4 and L7 layers. The Istio committee, led by Google and IBM, has made a strategic decision to designate the Istio gateway (constructed upon the Kubernetes gateway API) as the default resource for traffic management at the edge. For a visual representation of a sample Istio ingress implementation, please refer to the image below.</p><h3><strong>Advantages of Istio Ingress Gateway</strong></h3><p>As an integral component of the Istio service mesh, the Istio ingress gateway boasts numerous features and extensibility, providing architects with valuable tools for their application modernization journey. The following features are noteworthy:</p><ol><li>Istio ingress gateway offers advanced traffic management and routing capabilities, including:</li></ol><ul><li><strong>Rate limiting</strong></li><li><strong>Circuit breaking</strong></li><li><strong>Failover, and more.</strong></li></ul><ol><li>Leveraging Envoy within Istio ingress enables manipulation of HTTP headers for both requests and responses.</li><li>It comes equipped with robust out-of-the-box security features such as mutual TLS (mTLS) and access controls.</li><li>Extensible policy controls empower users with comprehensive network and security management.</li><li>The Istio Ingress Gateway ensures extensive telemetry and observability options.</li><li>Multiple load-balancing techniques and protocols are supported.</li></ol><h3><strong>Resources of Istio Ingress Gateway</strong></h3><p>The Istio Ingress Gateway provides specific resources for implementing various network and security functionalities:</p><ol><li><strong>Istio Gateway: </strong>This resource serves as the entry point for traffic originating from external sources. It proves useful for implementing TLS authentication certificates.</li><li><strong>Virtual Service: </strong>Configured within the Istio Ingress Gateway, the Virtual Service resource directs the traffic received by the gateway to backend services.</li><li><strong>Destination Rule:</strong> By defining variations in deployments within Kubernetes, the Destination Rule facilitates advanced deployment strategies such as canary releases or blue/green deployments.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*l7sfT3Oh4HlRl25dbxD0OA.png" /></figure><h3><strong>Let’s begin the implementation.</strong></h3><ul><li>Let’s now deploy Istio with the canary deployment option in the Kubernetes environment and see it in action.</li><li>“Firstly, let’s install Istio in the Kubernetes environment on AWS EKS, Azure AKS, GKE, Kubeadm, or Minikube, and complete the necessary components.”</li></ul><p><strong>Step-1:</strong> I will create the cluster in the Azure AKS environment using the following command, which will create both the resource group and Azure AKS.</p><pre>az group create --name rg-mkanus --location westus<br><br>az aks create --resource-group rg-mkanus --name mkanus --location westus --kubernetes-version 1.29.0 --tier standard --enable-cluster-autoscaler --min-count 2 --max-count 3 --max-pods 110 --node-vm-size Standard_D8ds_v5 --network-plugin azure --network-policy azure --load-balancer-sku standard --generate-ssh-key</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kAdWIDhcgtPT587G0cMllA.png" /></figure><ul><li>The resource group and Azure AKS (Azure Kubernetes Service) Kubernetes cluster have been created. We can use the kubectl get po -A command to view all the created resources.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pualcw8zFSQwEhPMHQa3uQ.png" /></figure><p><strong>Step-2: </strong>We will install istio/base, istio/istiod, and istio/gateway sequentially using Helm. If we install istio/istiod and istio/gateway without first installing istio/base, we may encounter issues fetching certain telemetry information. It is essential to install istio/base beforehand to ensure proper functionality.</p><pre>helm repo add istio https://istio-release.storage.googleapis.com/charts<br>helm repo update</pre><pre>helm upgrade --install istio-base istio/base --namespace istio-system --create-namespace --version 1.20.3 --set global.istioNamespace=istio-system<br># --version 1.20.3: Version of the Helm chart for installation.<br># --set global.istioNamespace=istio-system: Configures a specific value within the chart (e.g., istioNamespace under global).</pre><pre>helm upgrade --install istiod istio/istiod --namespace istio-system --version 1.20.3 --set telemetry.enabled=true,global.istioNamespace=istio-system,meshConfig.ingressService=istio-gateway,meshConfig.ingressSelector=gateway<br># --set telemetry.enabled=true: Enables Istiod&#39;s telemetry features.<br># global.istioNamespace=istio-system: Specifies the namespace where Istiod will operate.<br># meshConfig.ingressService=istio-gateway: Specifies the Ingress service.<br># meshConfig.ingressSelector=gateway: Specifies the Ingress selector.</pre><pre>helm upgrade --install gateway istio/gateway --namespace istio-ingress --create-namespace --version 1.20.3 --set service.externalTrafficPolicy=&quot;Local&quot;<br># --set service.externalTrafficPolicy=&quot;Local&quot;: Sets the externalTrafficPolicy for the Gateway service to &quot;Local&quot;. This ensures that incoming traffic is directed to local nodes.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-e-9YFkajvcU969Xe-zGDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5b3y4XgBh1uXRCjr8XUAlA.png" /></figure><p><strong>Step-3:</strong> The reason I want to run this command is to install Cert-Manager on my Kubernetes cluster. Cert-Manager is a valuable tool for managing TLS certificates in a Kubernetes environment. This Helm command initiates the installation process, creating a release named “cert-manager” in the specified namespace (“cert-manager”). The --set installCRDs=true flag is included to ensure the installation of Custom Resource Definitions (CRDs) that Cert-Manager relies on for its functionality. By deploying Cert-Manager, I aim to enhance the management and automation of TLS certificates within my Kubernetes infrastructure.</p><ul><li><strong>issuer-production.yaml:</strong> This YAML file defines the configuration for the certificate issuer used in the production environment. It specifies details such as the ACME server, email address, and any other parameters required for issuing production-grade TLS certificates.</li><li><strong>issuer-staging.yaml:</strong> Conversely, the issuer-staging.yaml file configures the certificate issuer for the staging environment. Staging issuers are typically used for testing purposes and may have rate limits or other restrictions that differ from the production environment. This allows for the validation and testing of certificate issuance workflows without affecting the production certificate quota.</li></ul><pre>helm upgrade --install cert-manager jetstack/cert-manager --create-namespace --namespace cert-manager --set installCRDs=true<br></pre><pre># issuer-production.yaml<br><br>---<br>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: production-cluster-issuer<br>spec:<br>  acme:<br>    server: https://acme-v02.api.letsencrypt.org/directory<br>    privateKeySecretRef:<br>      name: production-cluster-issuer<br>    solvers:<br>      - selector: {}<br>        http01:<br>          ingress:<br>            class: istio</pre><pre># issuer-staging.yaml<br><br>---<br>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: staging-cluster-issuer<br>spec:<br>  acme:<br>    # Staging Environment: must be used for testing before using prod env<br>    # Letsencrypt has a strict rate limit.<br>    server: https://acme-staging-v02.api.letsencrypt.org/directory<br>    privateKeySecretRef:<br>      name: staging-cluster-issuer<br>    solvers:<br>      - selector: {}<br>        http01:<br>          ingress:<br>            class: istio</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wRcisRpofWHHQss3V166Qg.png" /></figure><p><strong>Step-4:</strong> After loading the Istio and cert-manager helm chart onto Azure AKS Kubernetes, let’s install the sample application with the following manifest files. Of course, I will explain the critical sections in the manifest files to you.</p><ul><li>If you prefer, you can also directly download the manifest files to your local machine from the provided link.</li></ul><pre># 0-namespace.yaml<br><br>---<br>apiVersion: v1<br>kind: Namespace<br>metadata:<br>  name: hedgus<br>  labels:<br>    monitoring: prometheus<br>    istio-injection: enabled</pre><pre># 1-deployment-v1.yaml<br><br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: hedgus-app-v1<br>  namespace: hedgus<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: hedgus-app<br>      version: v1<br>  template:<br>    metadata:<br>      labels:<br>        app: hedgus-app<br>        version: v1<br>        istio: monitor<br>    spec:<br>      containers:<br>        - image: mehmetkanus17/hedgus-page:v1<br>          imagePullPolicy: IfNotPresent<br>          name: hedgus-app<br>          ports:<br>            - name: http<br>              containerPort: 80<br>              # protocol: TCP</pre><pre># 1-deployment-v2.yaml<br><br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: hedgus-app-v2<br>  namespace: hedgus<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: hedgus-app<br>      version: v2<br>  template:<br>    metadata:<br>      labels:<br>        app: hedgus-app<br>        version: v2<br>        istio: monitor<br>    spec:<br>      containers:<br>        - image: mehmetkanus17/hedgus-page:v2<br>          imagePullPolicy: IfNotPresent<br>          name: hedgus-app<br>          ports:<br>            - name: http<br>              containerPort: 80<br>              # protocol: TCP</pre><pre># 3-myapp-service.yaml<br><br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: hedgus-app<br>  namespace: hedgus<br>spec:<br>  ports:<br>    - name: http<br>      port: 80<br>  selector:<br>    app: hedgus-app</pre><pre># 4-destination-rule.yaml<br><br>---<br>apiVersion: networking.istio.io/v1beta1<br>kind: DestinationRule<br>metadata:<br>  name: hedgus-app<br>  namespace: hedgus<br>spec:<br>  host: hedgus-app<br>  subsets:<br>    - name: v1<br>      labels:<br>        app: hedgus-app<br>        version: v1<br>    - name: v2<br>      labels:<br>        app: hedgus-app<br>        version: v2</pre><pre># 5-virtual-service.yaml<br><br>---<br>apiVersion: networking.istio.io/v1beta1<br>kind: VirtualService<br>metadata:<br>  name: hedgus-app<br>  namespace: hedgus<br>spec:<br>  hosts:<br>    - mk.hedgus.com<br>    - hedgus-app<br>  gateways:<br>    - hedgus-api<br>  http:<br>    - match:<br>        - uri:<br>            prefix: /<br>      route:<br>        - destination:<br>            host: hedgus-app<br>            subset: v1<br>          weight: 50<br>        - destination:<br>            host: hedgus-app<br>            subset: v2<br>          weight: 50</pre><pre># 6-gateway.yaml<br><br>---<br>apiVersion: networking.istio.io/v1beta1<br>kind: Gateway<br>metadata:<br>  name: hedgus-api<br>  namespace: hedgus<br>spec:<br>  selector:<br>    istio: gateway<br>  servers:<br>    - port:<br>        number: 80<br>        name: http<br>        protocol: HTTP<br>      hosts:<br>        - mk.hedgus.com<br>    - port:<br>        number: 443<br>        name: https<br>        protocol: HTTPS<br>      hosts:<br>        - mk.hedgus.com<br>      tls:<br>        credentialName: hedgus-crt<br>        mode: SIMPLE</pre><pre># 7-certificate.yaml<br><br>---<br>apiVersion: cert-manager.io/v1<br>kind: Certificate<br>metadata:<br>  name: hedgus-com<br>  namespace: istio-ingress<br>spec:<br>  secretName: hedgus-crt<br>  dnsNames:<br>    - mk.hedgus.com<br>  issuerRef:<br>    name: production-cluster-issuer<br>    kind: ClusterIssuer<br>    group: cert-manager.io</pre><ul><li>As seen, when I deploy all application YAML files, we can observe that the certificate is obtained. Additionally, we can see that Istio adds an Envoy container next to each Hedgus application pod.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjwwzQ_tvco5YNJpFc5Xaw.png" /></figure><ul><li><strong>Envoy</strong> is an open-source edge and service proxy designed for cloud-native applications. It acts as a universal data plane, providing a common platform for various communication protocols in microservices architectures. Envoy is often used as a sidecar proxy deployed alongside application containers to manage and control traffic between services. It offers features such as load balancing, service discovery, and observability, making it a powerful tool for building resilient and scalable microservices-based systems. Envoy is a key component in service mesh architectures like Istio, helping to enhance communication reliability, security, and observability in distributed applications.</li><li>Two different versions of the application have been created using Canary Deployment, where 50% of the incoming traffic is directed to v1, and the remaining 50% is directed to v2 upon refreshing the browser page. This traffic flow is orchestrated by Istio’s capabilities.</li><li>In this configuration, Istio is employed to manage the traffic distribution between v1 and v2 of the hedgus App, demonstrating the capabilities of Istio in orchestrating canary deployments and controlling traffic flow based on defined weights and subsets. The VirtualService and DestinationRule resources specify the routing rules, while the Gateway resource defines the entry point for the Istio service mesh.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfU_IaNttmJKhFsRvckcwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BcKmzKZYH-yQbWn4hvUlbA.png" /></figure><p>Thank you for adding my article to your reading list! If you enjoyed it and found it helpful, please consider <strong>following</strong> me and giving the article a <strong>clap</strong>. Your support means a lot and helps me continue creating content that you love.</p><p>Thanks again, and happy reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bcefe6f4e86" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgus/istio-tutorial-ingress-gateway-virtual-service-gateway-ingress-mtls-2bcefe6f4e86">Istio Tutorial (Ingress Gateway — Virtual Service — Gateway — Ingress — mTLS)</a> was originally published in <a href="https://medium.com/hedgus">Hedgus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>