<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lord Jake</title>
    <description>The latest articles on DEV Community by Lord Jake (@paul8989).</description>
    <link>https://dev.to/paul8989</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F926305%2F44879897-d9c6-45b5-9fd4-20ed38d2b5c0.png</url>
      <title>DEV Community: Lord Jake</title>
      <link>https://dev.to/paul8989</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paul8989"/>
    <language>en</language>
    <item>
      <title>Service Bus Data not pulling through webhooks</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Thu, 12 Oct 2023 22:33:55 +0000</pubDate>
      <link>https://dev.to/paul8989/service-bus-data-not-pulling-through-webhooks-26ca</link>
      <guid>https://dev.to/paul8989/service-bus-data-not-pulling-through-webhooks-26ca</guid>
      <description>&lt;p&gt;We had an issue reported from App team where the messages was not going to service bus queue - this got fixed by enabling the private endpoint.&lt;/p&gt;

&lt;p&gt;Later there was an issue where the webhook listening to the queue is not receiving messaging.&lt;br&gt;
Changed the messaging type to AMQP and then NSG was modified to accept port 443 and 5671.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-protocol-guide"&gt;https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-protocol-guide&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Azure App Proxy Header Based SSO not passing headers to WebAPP</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Thu, 12 Oct 2023 09:36:06 +0000</pubDate>
      <link>https://dev.to/paul8989/azure-app-proxy-header-based-sso-not-passing-headers-to-webapp-a7b</link>
      <guid>https://dev.to/paul8989/azure-app-proxy-header-based-sso-not-passing-headers-to-webapp-a7b</guid>
      <description>&lt;p&gt;One of my customer wanted to implement SSO with Azure App Proxy, they had a requirement to display the username, and persist the username and user email back to the cosmos db to retrieve in future for further use cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Issue faced.&lt;/strong&gt;&lt;br&gt;
Headers sent from App Proxy was not reaching the webapp.&lt;/p&gt;

&lt;p&gt;We had an architecture similar to below one.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Checks done&lt;/strong&gt;&lt;br&gt;
First point of check was to intercept App proxy traffic and we indeed confirmed headers are being send from there.&lt;/p&gt;

&lt;p&gt;Second check was in nginx, from which the React UI is served. It looked like nginx was not forwarding the headers.&lt;/p&gt;

&lt;p&gt;We did the following changed in ngnix.conf and it started flowing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        location / {
            root /app/www/;
            add_header UserUPN $http_userupn;
            add_header UserDisplayName $http_userdisplayname;
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Second Issue&lt;/strong&gt;&lt;br&gt;
Another issue we faced was , the react UI was not able to fetch the response header, since it was loaded by nginx and no back end api calls are made as well during the load. We got were able to retrieve the headers after doing another get from the app proxy , but it was a round trip again. We finally overcame it by injecting the headers to response html meta headers using nginx using &lt;code&gt;sub_filter&lt;/code&gt;, and made react to read the dom and query the meta headers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        location / {
            root /app/www/;
            add_header userupn $http_userupn;
            add_header userdiplayname $http_userdisplayname;
            sub_filter '&amp;lt;/head&amp;gt;' '&amp;lt;meta name="userupn" content="$http_userupn" /&amp;gt;\n&amp;lt;meta name="userdisplayname" content="$http_userdisplayname" /&amp;gt;&amp;lt;/head&amp;gt;';
            sub_filter_once off;
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  React.useEffect(() =&amp;gt; {
    // Select all meta elements in the document's head
    const metaElements = document.head.querySelectorAll('meta');

    // Loop through the meta elements and extract values
    metaElements.forEach((meta) =&amp;gt; {
      const name = meta.getAttribute('name');
      const content = meta.getAttribute('content');

      // Check for the "userupn" and "userdisplayname" meta tags
      if (name === 'userupn') {
        setUserUpn(content || 'User Upn Not Found'); // Set the userUpn state
      } else if (name === 'userdisplayname') {
        setUserDisplayName(content || 'User'); // Set the userDisplayName state
      }
    });
  }, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>nginx</category>
      <category>azure</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Werkzeug Import Error - Python</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Wed, 04 Oct 2023 08:04:59 +0000</pubDate>
      <link>https://dev.to/paul8989/werkzeug-import-error-python-1b4l</link>
      <guid>https://dev.to/paul8989/werkzeug-import-error-python-1b4l</guid>
      <description>&lt;p&gt;We got the below error all of a sudden from the already working Flask api code yesterday. Looks like there was some changes in dependent Werkzeug  library.&lt;/p&gt;

&lt;p&gt;Mentioning the version of Werkzeug  in requirements.txt fixed the issue.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Werkzeug==2.3.7&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/77213053/importerror-cannot-import-name-url-quote-from-werkzeug-urls"&gt;https://stackoverflow.com/questions/77213053/importerror-cannot-import-name-url-quote-from-werkzeug-urls&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Enable CORS for API Management Development Portal using Terraform</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Thu, 27 Jul 2023 07:24:28 +0000</pubDate>
      <link>https://dev.to/paul8989/how-to-enable-cors-for-api-management-development-portal-using-terraform-1apo</link>
      <guid>https://dev.to/paul8989/how-to-enable-cors-for-api-management-development-portal-using-terraform-1apo</guid>
      <description>&lt;p&gt;Today I got a task to automate the Enable CORS feature in the Portal Overview of Developer Portal in Azure API Management Services.&lt;/p&gt;

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

&lt;p&gt;This can be achived either via azure_rm or az_api according to documentations. I used azure_rm to achieve this.&lt;/p&gt;

&lt;p&gt;We would need to create a policy file with CORS definitions and refer the file to the terraform configurations.&lt;/p&gt;

&lt;p&gt;Policy file will look as below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;policies&amp;gt;  
    &amp;lt;inbound&amp;gt;    
        &amp;lt;cors allow-credentials="true"&amp;gt;      
            &amp;lt;allowed-origins&amp;gt;        
                &amp;lt;origin&amp;gt;https://example-apim-19899.developer.azure-api.net&amp;lt;/origin&amp;gt;      
            &amp;lt;/allowed-origins&amp;gt;      
            &amp;lt;allowed-methods preflight-result-max-age="300"&amp;gt;        
                &amp;lt;method&amp;gt;*&amp;lt;/method&amp;gt;      
            &amp;lt;/allowed-methods&amp;gt;      
            &amp;lt;allowed-headers&amp;gt;        
                &amp;lt;header&amp;gt;*&amp;lt;/header&amp;gt;      
            &amp;lt;/allowed-headers&amp;gt;      
            &amp;lt;expose-headers&amp;gt;        
                &amp;lt;header&amp;gt;*&amp;lt;/header&amp;gt;      
            &amp;lt;/expose-headers&amp;gt;    
        &amp;lt;/cors&amp;gt;  
    &amp;lt;/inbound&amp;gt;  
    &amp;lt;backend&amp;gt;    
        &amp;lt;forward-request /&amp;gt;  
    &amp;lt;/backend&amp;gt;  
    &amp;lt;outbound /&amp;gt;
&amp;lt;/policies&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terraform code can be created as below to use the policy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "uksouth"
}

resource "azurerm_api_management" "example" {
  name                = "example-apim-19899"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  publisher_name      = "pub1"
  publisher_email     = "pub1@email.com"

  sku_name = "Developer_1"
}

resource "azurerm_api_management_policy" "example" {
  api_management_id = azurerm_api_management.example.id
  xml_content       = file("\\policy_files\\example.xml")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On running Terraform, the policies should be set and CORS should be enabled. Please make sure you give the origin in the policy file as the developer portal URL so that Azure correctly match it and it gets enabled in portal.&lt;/p&gt;

&lt;p&gt;If you need to try using AzApi further details can be found here.&lt;br&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/templates/microsoft.apimanagement/service/policies?pivots=deployment-language-terraform"&gt;https://learn.microsoft.com/en-us/azure/templates/microsoft.apimanagement/service/policies?pivots=deployment-language-terraform&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to run self hosted agent on Azure Container Instance</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Wed, 26 Oct 2022 16:24:18 +0000</pubDate>
      <link>https://dev.to/paul8989/how-to-run-self-hosted-agent-on-azure-container-instance-3kam</link>
      <guid>https://dev.to/paul8989/how-to-run-self-hosted-agent-on-azure-container-instance-3kam</guid>
      <description>&lt;p&gt;Azure Container Instance may be a good idea for some who don't want to run a full blown VM to run the Devops agent, which is light and probably cost effective.&lt;/p&gt;

&lt;p&gt;1 Create a container registry via portal or CLI.&lt;/p&gt;

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

&lt;p&gt;2 Create docker agent image and upload to the created container registry. The docker agent will depend on the OS to be used - I am using Ubuntu 20.04. &lt;/p&gt;

&lt;p&gt;3 I assume you have already a running docker engine or else please install and make the service up and running.&lt;/p&gt;

&lt;p&gt;4 &lt;code&gt;mkdir ~/dockeragent&lt;/code&gt;&lt;br&gt;
   &lt;code&gt;mkdir ~/dockeragent&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;5 Save the following content to ~/dockeragent/Dockerfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM ubuntu:20.04
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
    apt-transport-https \
    apt-utils \
    ca-certificates \
    curl \
    git \
    iputils-ping \
    jq \
    lsb-release \
    software-properties-common

RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

# Can be 'linux-x64', 'linux-arm64', 'linux-arm', 'rhel.6-x64'.
ENV TARGETARCH=linux-x64

WORKDIR /azp

COPY ./start.sh .
RUN chmod +x start.sh

ENTRYPOINT [ "./start.sh" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6 Save the following content to ~/dockeragent/start.sh&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
set -e

if [ -z "$AZP_URL" ]; then
  echo 1&amp;gt;&amp;amp;2 "error: missing AZP_URL environment variable"
  exit 1
fi

if [ -z "$AZP_TOKEN_FILE" ]; then
  if [ -z "$AZP_TOKEN" ]; then
    echo 1&amp;gt;&amp;amp;2 "error: missing AZP_TOKEN environment variable"
    exit 1
  fi

  AZP_TOKEN_FILE=/azp/.token
  echo -n $AZP_TOKEN &amp;gt; "$AZP_TOKEN_FILE"
fi

unset AZP_TOKEN

if [ -n "$AZP_WORK" ]; then
  mkdir -p "$AZP_WORK"
fi

export AGENT_ALLOW_RUNASROOT="1"

cleanup() {
  if [ -e config.sh ]; then
    print_header "Cleanup. Removing Azure Pipelines agent..."

    # If the agent has some running jobs, the configuration removal process will fail.
    # So, give it some time to finish the job.
    while true; do
      ./config.sh remove --unattended --auth PAT --token $(cat "$AZP_TOKEN_FILE") &amp;amp;&amp;amp; break

      echo "Retrying in 30 seconds..."
      sleep 30
    done
  fi
}

print_header() {
  lightcyan='\033[1;36m'
  nocolor='\033[0m'
  echo -e "${lightcyan}$1${nocolor}"
}

# Let the agent ignore the token env variables
export VSO_AGENT_IGNORE=AZP_TOKEN,AZP_TOKEN_FILE

print_header "1. Determining matching Azure Pipelines agent..."

AZP_AGENT_PACKAGES=$(curl -LsS \
    -u user:$(cat "$AZP_TOKEN_FILE") \
    -H 'Accept:application/json;' \
    "$AZP_URL/_apis/distributedtask/packages/agent?platform=$TARGETARCH&amp;amp;top=1")

AZP_AGENT_PACKAGE_LATEST_URL=$(echo "$AZP_AGENT_PACKAGES" | jq -r '.value[0].downloadUrl')

if [ -z "$AZP_AGENT_PACKAGE_LATEST_URL" -o "$AZP_AGENT_PACKAGE_LATEST_URL" == "null" ]; then
  echo 1&amp;gt;&amp;amp;2 "error: could not determine a matching Azure Pipelines agent"
  echo 1&amp;gt;&amp;amp;2 "check that account '$AZP_URL' is correct and the token is valid for that account"
  exit 1
fi

print_header "2. Downloading and extracting Azure Pipelines agent..."

curl -LsS $AZP_AGENT_PACKAGE_LATEST_URL | tar -xz &amp;amp; wait $!

source ./env.sh

print_header "3. Configuring Azure Pipelines agent..."

./config.sh --unattended \
  --agent "${AZP_AGENT_NAME:-$(hostname)}" \
  --url "$AZP_URL" \
  --auth PAT \
  --token $(cat "$AZP_TOKEN_FILE") \
  --pool "${AZP_POOL:-Default}" \
  --work "${AZP_WORK:-_work}" \
  --replace \
  --acceptTeeEula &amp;amp; wait $!

print_header "4. Running Azure Pipelines agent..."

trap 'cleanup; exit 0' EXIT
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM

chmod +x ./run-docker.sh

# To be aware of TERM and INT signals call run.sh
# Running it with the --once flag at the end will shut down the agent after the build is executed
./run-docker.sh "$@" &amp;amp; wait $!

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7 Build the docker image&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t &amp;lt;your-acr-name&amp;gt;.azurecr.io/dockeragent:latest .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;8 Upload the image to the already created container registry via CLI or portal;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;az acr login --name &amp;lt;acr name&amp;gt; --username &amp;lt;adminUsername&amp;gt; --password &amp;lt;adminPassword&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker push &amp;lt;your-acr-name&amp;gt;.azurecr.io/dockeragent:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;9 Verify the image is in the azure container registry repository from portal&lt;/p&gt;

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

&lt;p&gt;10 Create an Azure container Instance from either portal or via CLI , using the container registry attached.&lt;/p&gt;

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

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bJMVLFvN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g1s6z0vbewobcz31rial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bJMVLFvN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g1s6z0vbewobcz31rial.png" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;br&gt;
NB: You need to provide the environment variables here itself. I found it not able to edit the variables once after the container instance is provisioned.&lt;/p&gt;

&lt;p&gt;Below four are the variables required.&lt;br&gt;
AZP_URL=https: your devops url&lt;br&gt;
AZP_TOKEN=&amp;lt;Pat-Token-from-Azure-Devops&amp;gt;&lt;br&gt;
AZP_AGENT_NAME=&amp;lt;Your-agent-name-which will be displayed in ADO&amp;gt;&lt;br&gt;
AZP_POOL=&amp;lt;Pool-name- can be 'Default' as well&amp;gt;&lt;/p&gt;

&lt;p&gt;To get the PAT Token. Navigate to Azure Devops, select Personal Access Tokens from  User Settings Menu, and select New Token&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xFesLmFq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldpcmrkwm14wzebsqoo6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xFesLmFq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldpcmrkwm14wzebsqoo6.png" alt="Image description" width="625" height="499"&gt;&lt;/a&gt;&lt;br&gt;
Give it a name, and select &lt;em&gt;Custom defined permission&lt;/em&gt; for Agent Pools - &lt;em&gt;Read &amp;amp; Manage&lt;/em&gt;. If you are not able to see it, click on the bottom link to &lt;em&gt;show all scopes&lt;/em&gt;&lt;br&gt;
Once created copy the token, it won't be shown again.&lt;/p&gt;

&lt;p&gt;Once created the container instance should spin up and the agent should be start listening to.&lt;/p&gt;

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

&lt;p&gt;You can verify it checking in the AzureDevops Agent Pools too from Organization Settings.&lt;/p&gt;

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

&lt;p&gt;I ran a sample pipeline using the container pool and it ran succesfully.&lt;/p&gt;

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

&lt;p&gt;References:&lt;br&gt;
&lt;a href="https://jan-v.nl/post/2021/create-build-agent-with-azure-container-instances/"&gt;https://jan-v.nl/post/2021/create-build-agent-with-azure-container-instances/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops&amp;amp;WT.mc_id=AZ-MVP-5003246#create-and-build-the-dockerfile-1"&gt;https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops&amp;amp;WT.mc_id=AZ-MVP-5003246#create-and-build-the-dockerfile-1&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Install Azure CLI on arm64 Raspberry pi</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Tue, 25 Oct 2022 22:16:57 +0000</pubDate>
      <link>https://dev.to/paul8989/install-azure-cli-on-arm64-raspberry-pi-39mb</link>
      <guid>https://dev.to/paul8989/install-azure-cli-on-arm64-raspberry-pi-39mb</guid>
      <description>&lt;p&gt;According to Microsoft &lt;a href="https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt"&gt;documentations &lt;/a&gt;currently arm64 is not supported for Azure CLI. &lt;/p&gt;

&lt;p&gt;The only work around is to install via pip.&lt;/p&gt;

&lt;p&gt;The below worked for me, in RPi 4B, Ubuntu 20.04&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;&lt;br&gt;
First make sure python3 and its related packages are installed:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ubuntu/Debian&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install python3 python3-venv --yes

# Create a virtual environment
python3 -m venv azure-cli-env

# Update pip
azure-cli-env/bin/python -m pip install --upgrade pip

# Install azure-cli
azure-cli-env/bin/python -m pip install azure-cli

# Run any Azure CLI commands
azure-cli-env/bin/az --version 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Uninstall&lt;/strong&gt;&lt;br&gt;
Delete the virtual environment:&lt;br&gt;
&lt;code&gt;rm -rf azure-cli-env&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;a href="https://github.com/Azure/azure-cli/issues/20476"&gt;https://github.com/Azure/azure-cli/issues/20476&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.frakkingsweet.com/installing-azure-cli-on-arm64/"&gt;https://www.frakkingsweet.com/installing-azure-cli-on-arm64/&lt;/a&gt; - I am just posting this particular link for future reference, I haven't tried this.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Install Docker engine to a development Linux box - easy way</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Tue, 25 Oct 2022 21:21:31 +0000</pubDate>
      <link>https://dev.to/paul8989/install-docker-engine-to-a-development-linux-box-easy-way-180j</link>
      <guid>https://dev.to/paul8989/install-docker-engine-to-a-development-linux-box-easy-way-180j</guid>
      <description>&lt;p&gt;This method should only be used in development boxes not in production scenarios according to docker official documentation. Also validate the script before executing. You should not run this script to upgrade your existing docker engine, it may cause issues.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -fsSL https://get.docker.com -o get-docker.sh&lt;br&gt;
 sudo sh get-docker.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I found it really easy to get up and running for testing with docker on my raspberry pi4 running on Ubuntu 20.04.&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;a href="https://docs.docker.com/engine/install/ubuntu/"&gt;https://docs.docker.com/engine/install/ubuntu/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connect to WiFi on Ubuntu (Server version) via Terminal</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Tue, 25 Oct 2022 21:13:02 +0000</pubDate>
      <link>https://dev.to/paul8989/connect-to-wifi-on-ubuntu-server-version-via-terminal-18hg</link>
      <guid>https://dev.to/paul8989/connect-to-wifi-on-ubuntu-server-version-via-terminal-18hg</guid>
      <description>&lt;p&gt;This tutorial assume you have an active LAN connected, since you may need to install a package.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install network-manager&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then you can use the below interactive mode to search for wifi and connect to the same&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nmtui&lt;/code&gt;&lt;/p&gt;

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

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

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

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

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

&lt;p&gt;Now I can see the Wlan0 link is UP (which was DOWN before) and it has got an IP too.&lt;/p&gt;

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

&lt;p&gt;Found this really easy if you got a LAN or your ubuntu version has network-manager pre installed.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Failed pre-install: timed out waiting for the condition. Helm install error</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Wed, 19 Oct 2022 16:32:53 +0000</pubDate>
      <link>https://dev.to/paul8989/failed-pre-install-timed-out-waiting-for-the-condition-helm-install-error-53la</link>
      <guid>https://dev.to/paul8989/failed-pre-install-timed-out-waiting-for-the-condition-helm-install-error-53la</guid>
      <description>&lt;p&gt;Today I was trying to install ingress controller using helm3 and got an error like below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Error: INSTALLATION FAILED: failed pre-install: timed out waiting for the condition.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I felt the above error was not giving a proper indication of what went wrong, but this could be identified by collecting the event logs and see what is actually failing under the hood.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl -n &amp;lt;your-namespace&amp;gt; get events --sort-by='{.lastTimestamp}'&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Which showed me there was missing images in my azure container registry which was causing ErrImagePull.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Remote Windows PSSesssion not working from Linux K8s pod</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Tue, 18 Oct 2022 15:11:56 +0000</pubDate>
      <link>https://dev.to/paul8989/remote-windows-pssesssion-not-working-from-linux-k8s-pod-12fl</link>
      <guid>https://dev.to/paul8989/remote-windows-pssesssion-not-working-from-linux-k8s-pod-12fl</guid>
      <description>&lt;p&gt;Today we had an issue in which a microservice which was deployed onto a linux pod was not able to make a remote PowerShellSession (PSSession) to a Windows machine.&lt;/p&gt;

&lt;p&gt;The base image already had &lt;em&gt;PSWSMan&lt;/em&gt; and &lt;em&gt;openssl&lt;/em&gt; installed, but we were getting &lt;em&gt;&lt;strong&gt;MI_RESULT_ACCESS_DENIED&lt;/strong&gt;&lt;/em&gt; error.&lt;/p&gt;

&lt;p&gt;After long search through different posts and trial and errors, we were able to make the connection successful with the below changes in the docker image.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Add the two below packages to image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;RUN apt-get install netbase -y&lt;br&gt;
RUN apt-get install gss-ntlmssp -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Netbase:&lt;/strong&gt;&lt;br&gt;
Basic TCP/IP networking system&lt;br&gt;
This package provides the necessary infrastructure for basic TCP/IP based networking. In particular, it supplies common name-to-number mappings in /etc/services, /etc/rpc, /etc/protocols and /etc/ethertypes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;gss-ntlmssp:&lt;/strong&gt;&lt;br&gt;
GSS-NTLMSSP is a GSSAPI mechanism plugin that implements NTLMSSP. NTLMSSP is a Microsoft Security Provider that implements various versions and falvors of the NTLM challenge-response family.&lt;/p&gt;

&lt;p&gt;GSS-NTLMSSP, implements both NTLM and NTLMv2 and all the various security variants to the key exchange that Microsoft introduced and documented over time.&lt;/p&gt;

&lt;p&gt;This code implements the NTLMSSP mechanism as a GSSAPI loadable mechanism and has been tested to work with MIT Kerberos' 1.11 implementation of GSSAPI.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Also the PSSession command was ran with the &lt;em&gt;Negotiate&lt;/em&gt; authentication method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Enter-PSSession -ComputerName &amp;lt;IP/Hostname&amp;gt; -Credential &amp;lt;xxxxx&amp;gt; -Authentication Negotiate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References and further reading&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://packages.debian.org/sid/netbase"&gt;https://packages.debian.org/sid/netbase&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/gssapi/gss-ntlmssp"&gt;https://github.com/gssapi/gss-ntlmssp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://packages.debian.org/sid/libs/gss-ntlmssp"&gt;https://packages.debian.org/sid/libs/gss-ntlmssp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.bloggingforlogging.com/2020/08/21/wacky-wsman-on-linux/"&gt;https://www.bloggingforlogging.com/2020/08/21/wacky-wsman-on-linux/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/PowerShell/PowerShell/issues/6647"&gt;https://github.com/PowerShell/PowerShell/issues/6647&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/jborean93/omi/issues/29"&gt;https://github.com/jborean93/omi/issues/29&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.crowdstrike.com/cybersecurity-101/ntlm-windows-new-technology-lan-manager/"&gt;https://www.crowdstrike.com/cybersecurity-101/ntlm-windows-new-technology-lan-manager/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>linux</category>
      <category>azure</category>
    </item>
    <item>
      <title>AKS node crash and Sonar rebuild</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Sat, 15 Oct 2022 11:30:43 +0000</pubDate>
      <link>https://dev.to/paul8989/aks-node-crash-and-sonar-rebuild-h61</link>
      <guid>https://dev.to/paul8989/aks-node-crash-and-sonar-rebuild-h61</guid>
      <description>&lt;p&gt;Today we had a strange issue in which a pipeline in Azure devops was failing and on investigation we came to know that , it was failing  due to sonar errors which in turn pointed to the sonarqube pod deployed in the cluster getting evicted and the node was under severe memory pressure with lots of evicted pods building up which further pressurized the node. The reason for severe memory pressure was not clear though, but we followed the below steps to get things back up again.&lt;/p&gt;

&lt;p&gt;Tried deleting the evicted pods to check if the node was getting recovered.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl delete pods --field-selector=status.phase=Failed --all-namespaces&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Since this didn't resolve, we scaled out the cluster, using Azure portal.&lt;br&gt;
Select the cluster -&amp;gt; Node pools -&amp;gt; Select the Nodepool -&amp;gt; Scale pool -&amp;gt; Scale to 2 more nodes ( we had 3 , we scale to 5)&lt;/p&gt;

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

&lt;p&gt;Meanwhile the affected node was &lt;a href="https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/"&gt;tainted &lt;/a&gt;with a Memory Pressure hence no pods were getting allocated to it.&lt;/p&gt;

&lt;p&gt;Once the new nodes were started, we drained the problematic node and took it down. This is for safely evicting the pods. More on the link &lt;a href="https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once drained and the node was taken down. Still the sonar pod was not getting scheduled on any nodes.&lt;/p&gt;

&lt;p&gt;We checked sonar pods describe to see the events&lt;br&gt;
&lt;code&gt;kubectl describe po sonar -n sonar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Pods were not able to get scheduled due to a volume node affinity conflict as below&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZDlArWQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebrt817ysf611tjzxke3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZDlArWQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebrt817ysf611tjzxke3.png" alt="Image description" width="800" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We checked the persistent volume claim (&lt;a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/"&gt;pvc&lt;/a&gt;) in sonar namespace&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get pvc -n sonar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Described the &lt;em&gt;sonar-pvc&lt;/em&gt;&lt;br&gt;
&lt;code&gt;kubectl describe pv pvc-xxxxxx&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Now the issue got narrowed down to a possibility that we don't have a node in a particular availability-zone in Azure, where the pvc is currently configured to. The sonar pods should be put on the same node to connect with the pvc (all in same availability zone node) hence the error.&lt;/p&gt;

&lt;p&gt;So we scaled down the instances to 2 and then scaled up back to 3, and AKS created nodes in each zone which also created a node in &lt;br&gt;
southeastasia-3 , which is now is agreement with the pvc node affinity section.&lt;/p&gt;

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

&lt;p&gt;And this made the sonar pods to be deployed to the node with affinity and thereby bringing the sonar up resolving the pipeline issue as well.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>K8s POD Auto scaling with KEDA and Azure Service Bus</title>
      <dc:creator>Lord Jake</dc:creator>
      <pubDate>Sat, 15 Oct 2022 10:15:48 +0000</pubDate>
      <link>https://dev.to/paul8989/k8s-pod-auto-scaling-with-keda-and-azure-service-bus-1en7</link>
      <guid>https://dev.to/paul8989/k8s-pod-auto-scaling-with-keda-and-azure-service-bus-1en7</guid>
      <description>&lt;p&gt;In one of my projects we had a requirement to scale the pods based on the queue depth of the Topic in Azure Service Bus and the search ended in KEDA - Kubernetes Event Driven Autoscaling which is a cloud native foundation, incubation project. Now let's look how we can setup Keda in our cluster.&lt;/p&gt;

&lt;p&gt;KEDA works alongside standard Kubernetes components like the Horizontal Pod Autoscaler and can extend functionality without overwriting or duplication.&lt;/p&gt;

&lt;p&gt;Keda got two key roles within the cluster, keda-operator which scales from minimum to maximum pod counts set in the ScaledObject manifest file via Kubernetes Horizontal Pod Autoscaler and keda-operator-metrics-apiserver which gets the data for the scaling decision. &lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Keda Installation&lt;/strong&gt;&lt;br&gt;
Keda operator and metric api-server can be installed in its own namespace and we will deploy the actual scaledobject component in the same namespaces where the pods to be scaled are.&lt;/p&gt;

&lt;p&gt;Keda can be installed in different ways, I chose using Helm, kubectl scripts are also available in the Keda &lt;a href="https://keda.sh/docs/2.8/deploy/"&gt;website &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Keda using Helm&lt;/strong&gt;&lt;br&gt;
Add Helm repo&lt;br&gt;
&lt;code&gt;helm repo add kedacore https://kedacore.github.io/charts&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Helm repo&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;helm repo update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Keda Helm chart&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;kubectl create namespace keda&lt;br&gt;
helm install keda kedacore/keda --namespace keda&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuring the Azure Service Bus SAS policy&lt;/strong&gt;&lt;br&gt;
For configuring KEDA to operate on the ServiceBus, it would require management permission.&lt;/p&gt;

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

&lt;p&gt;You can select the connection strings from this SAS key for updating in the KEDA yaml manifest&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;YAML Manifests&lt;/strong&gt;&lt;br&gt;
Scaling is made by a ScaledObject, which in turn uses the TriggerAuthentication object for the Azure Service Bus authentication.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Secret
metadata:
  namespace: poc 
  name: keda-secrets
  labels:
    app: exchange-jobs
data:
  management-connectionstring: &amp;lt;***Your base 64 encoded connection string from Azure SAS Key section with manage permissions****&amp;gt;
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  namespace: poc
  name: exchange-jobs-keda-scaler
spec:
  scaleTargetRef:
    name: exchange-jobs
  pollingInterval: 1   # Optional. Default: 30 seconds - checks for the changes
  cooldownPeriod: 20   # Optional. Default: 300 seconds - shutdown - need to find a sweet spot , Its better to keep default so that we don't interrupt any running processes
  minReplicaCount: 0
  maxReplicaCount: 50  # Optional. Default: 100
  triggers:
  - type: azure-servicebus
    metadata:
      topicName: mytopic
      subscriptionName: S1
      namespace: test-sb-keda-scaler   
      messageCount: "5" # need to find a sweet spot
    authenticationRef:
      name: keda-sbus-auth

---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  namespace: poc
  name: keda-sbus-auth
spec:
  secretTargetRef:
  - parameter: connection
    name: keda-secrets
    key: management-connectionstring
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above yaml can be applied to the namespace where the pods are present and it should work as expected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Things to note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The cool down lesser than 300 seconds (which is the default) will only work if you set the minReplicaCount to 0. If you don't specify a minReplicaCount Keda assumes as 0.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SB Connection string should be given as base 64 encoded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TriggerAuthentication object parameter is &lt;em&gt;connection&lt;/em&gt; not &lt;em&gt;connectionString&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you need a SBUS topic sender and receiver for testing console app please find it &lt;a href="https://github.com/paul8989/cloudbytes/tree/main/Sbus"&gt;here  &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some useful references.&lt;/strong&gt;&lt;br&gt;
◉ Kubernetes Event-driven Autoscaling – &lt;a href="https://aka.ms/azfr/662/01"&gt;https://aka.ms/azfr/662/01&lt;/a&gt;&lt;br&gt;
◉ KEDA on GitHub – &lt;a href="https://aka.ms/azfr/662/02"&gt;https://aka.ms/azfr/662/02&lt;/a&gt;&lt;br&gt;
◉ Azure Functions on Kubernetes with KEDA – &lt;a href="https://aka.ms/azfr/662/03"&gt;https://aka.ms/azfr/662/03&lt;/a&gt;&lt;br&gt;
◉ Azure Friday - Azure Serverless on Kubernetes with KEDA – &lt;a href="https://aka.ms/azfr/662/04"&gt;https://aka.ms/azfr/662/04&lt;/a&gt;&lt;/p&gt;

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