Posts

Showing posts from March, 2023

Imperative and Declarative approaches in kubernetes

 Imperative and Declarative approaches in kubernetes In Kubernetes, there are two ways to define and manage resources: imperative and declarative. Imperative Approach: The imperative approach is a way of defining and managing resources in Kubernetes by directly giving commands to the Kubernetes API server. It involves using command-line tools to execute a sequence of commands that specify the desired state of a resource. Here's an example of creating a deployment using the imperative approach: $ kubectl create deployment my-deployment --image=my-image --replicas=3 This command creates a deployment named my-deployment using the image my-image and sets the number of replicas to 3 . $ kubectl create deployment my-deployment --image=my-image --replicas=3 --labels=app=my-app,tier=backend This command creates a deployment named my-deployment using the image my-image , sets the number of replicas to 3 , and applies the labels app=my-app and tier=backend . Declarat...

String Methods in python, JavaScript and GO

String methods in Python, JavaScript and GO Python: # capitalize() string = " hello, world! " capitalized_string = string . capitalize () print ( capitalized_string ) # "Hello, world!" # lower() string = " HELLO, WORLD! " lowercase_string = string . lower () print ( lowercase_string ) # "hello, world!" # upper() string = " hello, world! " uppercase_string = string . upper () print ( uppercase_string ) # "HELLO, WORLD!" # strip() string = "  hello, world!   " stripped_string = string . strip () print ( stripped_string ) # "hello, world!" # replace() string = " hello, world! " replaced_string = string . replace ( " hello " , " hi " ) print ( replaced_string ) # "hi, world!" # str.startswith() example string = " Hello, World! " if string . startswith ( " Hello " ):   print ( " The string starts with 'Hello' " ) # s...

How to format strings in python, javascript and go?

How to Format strings in Python, JavaScript and GO Python Python provides a powerful and flexible way to format strings using the str.format() method or f-strings. Example 1: name = "Alice" age = 25 print ( "My name is {} and I am {} years old." . format (name, age))   Output: My name is Alice and I am 25 years old.     Example 2: name = "Bob" age = 30 print ( f "My name is {name} and I am {age} years old." )   Output: My name is Bob and I am 30 years old.   Example 3: num1 = 10 num2 = 20 result = num1 * num2 print ( "The product of {} and {} is {}" . format (num1, num2, result))   Output: The product of 10 and 20 is 200   Example 4: name = "Alice" age = 25 print ( "My name is {0} and I am {1} years old. {0} is a nice name." . format (name, age))   Output: My name is Alice and I am 25 years old. Alice is a nice name.   JavaScript JavaScript ...

Minikube commands

List of few minikube commands  Minikube is a popular tool for local Kubernetes cluster setup. It allows developers to experiment and test their applications on a small Kubernetes cluster on their local machine before deploying to a production environment. Minikube provides a simple command-line interface for managing the lifecycle of the Kubernetes cluster. In this blog, we will discuss some of the commonly used Minikube commands, their usage, and output with examples. minikube start: The "minikube start" command is used to start a new Minikube cluster. It creates a virtual machine (VM) on the local machine and installs Kubernetes on it. Here's an example of how to start a new Minikube cluster: $ minikube start 😄   minikube v1.23.2 on Darwin 11.6.2 ✨   Automatically selected the hyperkit driver. Other choices : docker, virtualbox 👍   Starting control plane node minikube in cluster minikube 💾   Downloading Kubernetes v1.23.2 preload ....