Posts

Showing posts from January, 2022

Kubernetes objects with practical examples

  1. Pod Example : Suppose you have a simple web application with a single container. Definition : A Pod could be defined as follows: apiVersion: v1 kind: Pod metadata: name: my-web-app spec: containers: - name: web-container image: nginx:latest ports: - containerPort: 80 Explanation : This Pod definition runs an Nginx container, exposing port 80. 2. Service Example : To expose the my-web-app Pod so it can be accessed from other Pods or externally. Definition : A Service could be defined as follows: apiVersion: v1 kind: Service metadata: name: my-web-service spec: selector: app: my-web-app ports: - protocol: TCP port: 80 targetPort: 80 type: LoadBalancer Explanation : This Service targets Pods with the label app: my-web-app and exposes port 80. The LoadBalancer type will provision an external IP address (if supported by the cloud provider). 3. Deployment Example : To deploy multiple re...

Kubernetes objects - Roles

 Kubernetes is a powerful container orchestration platform that helps manage and automate the deployment, scaling, and operation of application containers. It uses several key objects to achieve this, each serving a specific purpose. Here’s a rundown of some of the most important Kubernetes objects and their roles: 1. Pod Definition : The smallest and simplest Kubernetes object. A Pod represents a single instance of a running process in your cluster. Details : A Pod can contain one or more containers that share the same network namespace and storage volumes. Containers within a Pod can communicate with each other using localhost . 2. Service Definition : A Service is an abstraction that defines a logical set of Pods and a policy by which to access them. Details : Services enable communication between different parts of your application or with external applications. They provide load balancing and service discovery by assigning a stable IP address and DNS name to the set of Pods. 3...

Kubernetes object

 Kubernetes is a powerful container orchestration platform that uses various objects to manage the deployment, scaling, and operation of application containers. Here’s a step-by-step guide to some of the key Kubernetes objects with examples: 1. Pod A Pod is the smallest and simplest Kubernetes object. It represents a single instance of a running process in your cluster. Example: Create a file named pod-example.yaml : apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: my-container image: nginx:latest ports: - containerPort: 80 Commands: kubectl apply -f pod-example.yaml kubectl get pods kubectl describe pod my-pod 2. Service A Service is an abstraction that defines a logical set of Pods and a policy by which to access them. This can be used to expose your application. Example: Create a file named service-example.yaml : apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app: my-app po...