Posts

kyaml in k8s yaml definition

Image
As we are moving away from yaml to kyaml. The code snippet here shows the differences and what sort of conversion we are looking at.  What changed between them YAML KYAML Structure Indentation decides nesting Explicit { } and [ ] , so whitespace no longer matters. Look at ports and env sections  String values Quotes are optional and inconsistent Always double-quoted Keys Quoted or unquoted Unquoted Commas None Present, including a trailing comma after the last item Header None Leading --- , so it can’t be mistaken for broken JSON Comments Allowed Still allowed (JSON can’t do this)  

gcp setting up alert using promql

Image
To setup alert using promql, please goto  ttps://console.cloud.google.com/monitoring/alerting And then select "alerting". Before that place make sure you have configure or setup your "notification" channel.  And then click on "create policy". And we choose "PromQL" and add in our query - as shown here :-  And then we will try to configure - the evaluation window for this alert. We will set it to 5 min. And then we configure our evaluation channel :- Finally we will give our alert a name and click "create policy". 

k8s pod level resource limit definitions for all containers to use

This is an example of a yaml that shows k8s pod level resource limit defintions where containers will shared among themselves.  Yaml can be shown here :- apiVersion : apps/v1 kind : Deployment metadata :   name : my-app   namespace : default   labels :     app : my-app spec :   replicas : 2   revisionHistoryLimit : 5   selector :     matchLabels :       app : my-app   strategy :     type : RollingUpdate     rollingUpdate :       maxSurge : 1       maxUnavailable : 0   template :     metadata :       labels :         app : my-app     spec :       # Pod-level resources: shared by all containers in the pod.       # Stable in Kubernetes 1.37; on older versions it needs the       # PodLevelResources feature gate (beta/on by default from 1.34).       r...

gcp metric explorer using promql

Image
GCP metric explorer supports PromQL. Ideally we should use the UI to help us build our PromQL.  All we need to do is to click on the "Add query" and then we can select the metric that is relevant to us. In this case it is " dns_request_count ". Here is the sample PromQL that is generated.  { "__name__" = "kubernetes_io:pod_volume_utilization" } Memory request utilization over time  avg_over_time ({ "__name__" = "kubernetes.io/container/memory/request_utilization" , "monitored_resource" = "k8s_container" , "pod_name" = "autoscaling-metrics-adapter-857f68dbcd-kmvw8" }[ ${ __interval } ]) Dns request count over time  sum ( rate ({ "__name__" = "kubernetes.io/networking/dns/kubedns/dns_request_count" , "monitored_resource" = "k8s_container" }[ ${ __interval } ])) Add additional criteria  sum ( rate ({ "__name__" = "kubernetes.io/networki...

gcp getting started with LQL

Image
When working with GCP LQL, we need to work with fields and the log query language itself. To identify what fields that is available we can always check it here. There are the field that is available for us to query. If you expand that, you can discover more fields. Next we can also use SEARCH to all a full search (non case sensitive) of all the fields for example. This will retrieve log entry that contains "simple" or "Simple". SEARCH ( "Simple" ) gcloud logging write my - test - log "A simple entry." gcloud logging write my - test - log "A simple entry. There are the operator that you can use to refine your query with fields We can also write to our log using gclod command.  gcloud logging write my-test-log "A simple entry." Quick Summary Cheat Sheet Goal Operator / Syntax Example Starts with ( abc* ) =~ "^abc.*" protoPayload.methodName =~ "^v1.instances.*" Ends with ( *xyz ) =~ ".*xyz$" htt...