DEV Community

mahir dasare
mahir dasare

Posted on

Monolithic vs Microservices

Monolithic vs Microservices
Monolithic Architecture:

  • Single codebase
  • Tightly coupled components
  • Difficult to scale individual features
  • Suitable for small-scale applications
    Microservices Architecture:

  • Application broken into smaller, independent services

  • Services communicate via APIs

  • Easier to scale and deploy independently

  • Ideal for complex and scalable applications

_Kubernetes Architecture
_To understand the architecture and components of your Kubernetes cluster:

kubectl cluster-info

Display cluster information (API server, DNS, etc.)

Setup on Local/AWS EC2
Create a local Kubernetes cluster using Kind (Kubernetes IN Docker):
kind create cluster --name tws-cluster --config=config.yml

Creates a Kind cluster with the given name and configuration

Set the context to the newly created cluster:

kubectl config use-context kind-tws-cluster

Switch to the context of the Kind cluster

Kubectl and Pods
kubectl get nodes

List all nodes in the cluster

kubectl run nginx --image=nginx -n nginx

Create an nginx pod in the 'nginx' namespace

kubectl describe pod nginx -n nginx

Show detailed information about the nginx pod

_Namespaces, Labels, Selectors, and Annotations
_
kubectl create namespace monitoring

Create a namespace named 'monitoring'

kubectl get namespaces

List all namespaces in the cluster

kubectl label namespace monitoring team=devops

Add a label 'team=devops' to the 'monitoring' namespace

kubectl describe namespace monitoring

Display detailed information about the 'monitoring' namespace

Workloads
Deployments
kubectl apply -f deployment.yml

Deploy a workload defined in deployment.yml

kubectl scale deployment nginx-deployment --replicas=3 -n nginx

Scale the nginx deployment to 3 replicas

StatefulSets_
_kubectl apply -f statefulset.yml

Deploy a StatefulSet using the configuration file

kubectl describe statefulset mysql -n database

Display detailed information about the 'mysql' StatefulSet

*DaemonSets
*

kubectl apply -f daemonset.yml

Deploy a DaemonSet to run pods on every node

kubectl describe daemonset fluentd -n logging

Show details about the 'fluentd' DaemonSet

ReplicaSets

kubectl apply -f replicaset.yml

Deploy a ReplicaSet using the specified YAML file

kubectl describe replicaset nginx-replicaset -n nginx

Show detailed information about the 'nginx-replicaset'

Jobs and CronJobs

kubectl apply -f job.yml

Deploy a one-time Job using job.yml

kubectl apply -f cronjob.yml

Deploy a CronJob to schedule recurring tasks

END

Top comments (0)