Posts

Azure Aks automatic PDB

Azure AKS Automatic PDB provides automatic protection for your deployments during kubernetes upgrades or evictions. It supports HPA, KEDA and straight up deployment. One significant benenift is AKS upgrade sometimes are blocked by too restrictive PDB, with this extension we would be able to manage our cluster Installing the extension az feature register --namespace Microsoft.KubernetesConfiguration --name Extensions # Verify registration status az feature show --namespace Microsoft.KubernetesConfiguration --name Extensions # After the feature shows "Registered", refresh the provider az provider register -n Microsoft.KubernetesConfiguration Verifying the installation  kubectl get pdb -A -o custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,MIN-AVAILABLE:.spec.minAvailable,OWNER:.metadata.annotations.ownedBy | grep EvictionAutoScaler Setting up cluster wide PDB management Here we will target specific all namespaces az k8s-extension create --cluster-name <cluste...

yq refresher

  Reading YAML in Bash with Examples For YAML files, you'll want to use yq (the YAML equivalent of jq ).  Sample YAML File Save this as config.yaml : dev: url: http://dev.com test: url: http://test.com Using yq   Extract dev URL $ yq '.dev.url' config.yaml Output: http://dev.com Extract test URL $ yq '.test.url' config.yaml Output: http://test.com Extract both URLs $ yq '.[] | .url' config.yaml Output: http://dev.com http://test.com Store in variables $ DEV_URL=$(yq '.dev.url' config.yaml) $ TEST_URL=$(yq '.test.url' config.yaml) $ echo "Dev: $DEV_URL" $ echo "Test: $TEST_URL" Output: Dev: http://dev.com Test: http://test.com Extract both conditionally (if they exist) $ yq 'keys[] as $env | {env: $env, url: .[$env].url}' config.yaml Output: env: dev url: http://dev.com --- env: test url: http://test.com Load all environments into variables #!/bin/bash # Using yq DEV_URL=$(yq ...

jq refresher

jq Tutorial with Examples & Output Let me walk through this with real JSON data and actual outputs. Sample Data { "users": [ {"id": 1, "name": "Alice", "age": 28, "dept": "engineering", "salary": 95000}, {"id": 2, "name": "Bob", "age": 35, "dept": "sales", "salary": 75000}, {"id": 3, "name": "Charlie", "age": 24, "dept": "engineering", "salary": 65000}, {"id": 4, "name": "Diana", "age": 42, "dept": "management", "salary": 120000}, {"id": 5, "name": "Eve", "age": 31, "dept": "sales", "salary": 80000} ] } Basic Navigation Get the users array: $ jq '.users' data.json Output: [ {"id": 1, ...

azure pipeline - writting and referencing it from different stage

In Azure devops, we can often write and then reference an output variable from a different stage or job.  We can references it via dependencies.job_name.outputs["step_name.variable_name"] - stage : Build     displayName : ' Build Stage '         jobs :             # JOB 2: Output Variables (sharing between jobs)       - job : Job2_OutputVariables         displayName : ' Job 2: Set Output Variables for Later Jobs '                 variables :           jobMessage : ' Hello from Job 2 '                 steps :           # Create a variable that can be used in dependent jobs           - script : |               echo "##vso[task.setvariable variable=sharedOutput;isOutput=true]Hello from Job2 Outpu...

mcp server :- from fastmcp.server.auth.providers.jwt import JWTVerifier cannot be resolve

When trying to use JWTVerified, I getting this error :- from fastmcp.server.auth.providers.jwt import JWTVerifier  cannot be resolve Then have to ensure I added the following packages  pip uninstall mcp pip install fastmcp And then I was able to references it  from mcp . server . fastmcp import FastMCP from fastmcp import FastMCP from fastmcp . server . auth . providers . jwt import JWTVerifier The only problem with this is there's 2 framework FastMCP - one derive from fastmcp pypi and the other mcp pypi. Mixing both of these is not a good dea and really confusing. 

container app - deploying and setting up mcp server and calling it remotely from your vscode agent

Image
To create a container app, we need to setup our mcp server code, then deploy to the server in Azure. Finally we will test it using our vscode.   The following are the code we using for todo task.  from mcp . server . fastmcp import FastMCP from mcp . server . transport_security import TransportSecuritySettings from task_store import store mcp = FastMCP ( " TasksMCP " , stateless_http = True ,               transport_security = TransportSecuritySettings ( enable_dns_rebinding_protection = False )               ) @ mcp . tool () async def list_tasks () -> list [ dict ]:     """ List all tasks with their ID, title, description, and completion status. """     return store . get_all () @ mcp . tool () async def get_task ( task_id : int ) -> dict | None :     """ Get a single task by its numeric ID.     Args:         tas...

argocd - "Source position should be specified and must be greater than 0 for applications with multiple sources"

Image
Ran into this error  "Source position should be specified and must be greater than 0 for applications with multiple sources" and trying to make my app sync policy from manual to auto argocd app set cert-manager-dev --sync-policy automated So in our setup we have multiple (2 sources) and it gets confused which one to used for our app sync process.   

argocd deploying applications commonly used commands

Image
We meed to install argocd :- kubectl create namespace argocd kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml Make sure we have argocd app server up and running kubectl port-forward svc/argocd-server -n argocd 8080 :443 To create a temporarily initial password to login argocd admin initial-password -n argocd To login to argocd run the following commands:-  argocd login localhost:8080 Lets create an app  argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default Then sync the code changes :-  argocd app sync guestbook To list the app argocd app list  Get the app in details argocd app get guestbook To disable sync  argocd app set  guestbook --sync-policy manual To terminate sync   argocd app terminate-op cert-manager...