top of page

Microservices K8 Ready

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Jul 14, 2022
  • 1 min read

Updated: Sep 13, 2023

How To Make Microservices Kubernetes Ready


Prerequisite

· Kubernetes

· Docker

· K8 cluster-will make use of GCP K8 cluster

ree

Sample Microservices Architecture



· K8 Deployment

· K8 services

· K8 loadbalancer type for exposing services

·

ree

kubectl comand

---

kubectl cluster-info

kubectl get node

kubectl create deployment deployment-name --image=image name --port=8080

kubectl get deployment

kubectl describe deployment deployment-name

kubectl get pods

kubectl logs nameofpod


# in a namespace

kubectl api-resource --namespaced=true


#not in a namespace

kubctl api-resource --namespaced=falseV


expose deployment

==

kubectl get deployments

kubectl expose deployment deployment-name --type=NodePort

kubectl get service


Kubenetes Namespaces

===

default namespace is virtual cluster withinh k8 cluster. It is normally for system realted work, we should not store our application in this namespace.


ree

Better Approach

==


ree

Below are the k8 default namespaces

kubectl get namespaces



ree

Namespace type

====

deafult

if namepace is not defined,then all resources will be tagged to default namespace.


kube-system

This is reseved for k8 resources while creating k8 cluster

for eg: Master Node- API Server,Controller Manager,Schedular,ETCD

Worker Node - Kubelet,kubeproxy


It is not recommended to use this namespace for our application resources like pod,deployment,service etc....


kube-public

This is open for all, it has all cluster information.Everyone can read and access this namespace.


kube-node-lease

This is associated with lease object for each node and improve the performance of node and heartbeats.



ree

We can create our namespace and application resources will be tagged to that namespace.

ree

ree

#to create namespace

kubectl create namespace my-namespace


# to deploy resources in my-namespace

kubectl apply -f deploy.yml --namespace=my-namespace


# to get resources in my-namespace

kubectl get deployment -n my-namespace

kubectl get pods -n my-namespace



ree





 
 
 

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page