Posts

aws role based policy understanding

In this setup, you create a role and then give it some permission. Then whenever a user would like to use it, they assume this role. Typically this can be done simply  aws sts assume-role --role-arn arn:aws:iam::my-aws-id:role/s3-power-user --role-session-name jeremy-session And you can test it out simply by running the following commands:- aws s3 ls s3://appjerwo-demo-test aws s3 cp test.txt s3://appjerwo-demo-test/  aws s3 cp s3://appjerwo-demo-test/test.txt .  A typical policy would look like this. The key here is Action: "sts:AssumeRole". {     " Version " : " 2012-10-17 " ,     " Statement " : [         {             " Effect " : " Allow " ,             " Principal " : {                 " AWS " : " arn:aws:iam::(my-aws-id):root "             },             " Action ...

aws s3 bucket policy mistake

When configuring AWS policy, it can gets tricky, as i am using this policy on my bucket  {     " Version " : " 2012-10-17 " ,     " Statement " : [         {             " Principal " : {                 " AWS " : " arn:aws:iam::(masked-not-actual):user/jeremydev "             },             " Effect " : " Allow " ,             " Action " : [                 " s3:GetObject " ,                 " s3:PutObject " ,                 " s3:* "             ],             " Resource " : " arn:aws:s3:::appjerwo-demo-test "             ]         }     ] }...

coredns - beginner guide

Image
To get started with coredns, we can edit config map in kube-system.  kubectl edit cm/coredns -n kube-system And then we are going to add the following  apiVersion : v1 data :   Corefile : | 2     hello.test:53 {       errors       log       hosts {         10.0.0.42 hello.test       }       reload     }     .:53 {         errors         health {            lameduck 5s         }         ready         kubernetes cluster.local in-addr.arpa ip6.arpa {            pods insecure            fallthrough in-addr.arpa ip6.arpa            ttl 30         }         prometheus :9153       ...

Command to run dnslookup in your cluster.

i find myself keep on running into this task here. So figure i keep it handly and just copy and paste.  kubectl run -i --tty --rm dns-test --image=gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 --restart=Never -- sh

azure vnet - finding resources tied to a subnet

  A command that comes handy when trying to figure out resources tied to a specific subnet. az network vnet subnet show \   --resource-group MC_mytestvnet-rg_my-aks-pub-cluster_australiaeast \   --vnet-name aks-vnet-84320669 \   --name aks-apiserver-subnet \   --query "{Devices:ipConfigurations, Links:serviceAssociationLinks}"

AKS create free pricing tier from the command line

  This is an easier and cheaper way to create your cluster for a free tier. ✌ az aks create --name my-aks-pub-cluster --resource-group mytestvnet-rg --location AustraliaEast --network-plugin azure --enable-apiserver-vnet-integration --generate-ssh-keys --tier free --node-count 1 --node-vm-size Standard_A2v2

argocd configuring policies for application teams

Image
 We can define rules of what can be deploy to a kubernetes cluster. This is an example of what we can do  apiVersion : argoproj.io/v1alpha1 kind : AppProject metadata :   name : engineering-team-alpha   namespace : argocd spec :   description : " Restricted project for Team Alpha development work "     # 1. Restrict which repositories apps in this project can pull from   sourceRepos :     - " https://github.com/my-org/alpha-apps.git "   # 2. Restrict where these apps can be deployed (Cluster & Namespace)   destinations :     - server : https://kubernetes.default.svc       namespace : alpha-dev     - server : https://kubernetes.default.svc       namespace : alpha-staging   # 3. Whitelist: Only allow specific Namespaced resources   # This blocks ClusterRoles, CustomResourceDefinitions, etc.   clusterResourceWhitelist : [] # Empty means NO cluster-scoped resource...

argocd deploy keda helm chart with values files from a different repository

Image
Argocd implementation is so much simpler compare to flux. All you need is to create an Application object and then configure the helm charts and where to get your value files.  Please also note under the Application -> Spec -> sources -> helm -> valueFiles - i included the path there too. No additional row. Done.  The only thing i need to do is create the keda namespace. apiVersion : argoproj.io/v1alpha1 kind : Application metadata :   name : keda-deployment   namespace : argocd spec :   project : default   destination :     server : https://kubernetes.default.svc     namespace : keda   sources :     # Source 1: The Helm Chart (e.g., KEDA)     - repoURL : https://kedacore.github.io/charts       chart : keda       targetRevision : 2.15.0   # Use the specific chart version       helm :         valueFiles :        ...

argocd common task when working with application

 To list history  argocd app history guestbook To rollback application  argocd app set guestbook --sync-policy manual argocd app rollback guestbook argocd app rollback guestbook <specific version>  Sync  argocd app sync guestbook Force sync  argocd app sync guestbook --force 

argocd - Argo CD server address unspecified

To fix this just run the following command  argocd login localhost:8080   

autogen - getting started with gemini API

By default code initialization using Open API client, would uses OPEN API platform  https://platform.openai.com/account/api-keys.  To use Gemini, we have to initialize it using the following code to avoid issues. (otherwise it goes back to OPEN API endpoints instead of google AI endpoints (https://ai.google.dev) from autogen_agentchat . agents import AssistantAgent from autogen_agentchat . ui import Console from autogen_ext . models . openai import OpenAIChatCompletionClient import asyncio from autogen_core . models import ModelInfo from autogen_core . models import UserMessage # Run the agent and stream the messages to the console. async def main () -> None :     # model_client = OpenAIChatCompletionClient(     # model="gemini-1.5-flash-8b",     # api_key="AIzaSyAZPjwmY7e5Ti9NKHzjPjbYQpx1dmPwLI8",     # )     model_client = OpenAIChatCompletionClient (     model = " gemini-2.0-flash-lite " , ...