<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: rohitreddyk33</title>
    <description>The latest articles on Forem by rohitreddyk33 (@rohitreddyk33).</description>
    <link>https://forem.com/rohitreddyk33</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1017029%2Fca840295-fde4-40dc-8294-ea7343e2c4f1.jpg</url>
      <title>Forem: rohitreddyk33</title>
      <link>https://forem.com/rohitreddyk33</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rohitreddyk33"/>
    <language>en</language>
    <item>
      <title>Everything a DevOps Engineer must know about kubernetes.</title>
      <dc:creator>rohitreddyk33</dc:creator>
      <pubDate>Mon, 13 Feb 2023 05:13:45 +0000</pubDate>
      <link>https://forem.com/rohitreddyk33/everything-a-devops-engineer-must-know-about-kubernetes-1ap</link>
      <guid>https://forem.com/rohitreddyk33/everything-a-devops-engineer-must-know-about-kubernetes-1ap</guid>
      <description>&lt;p&gt;*&lt;em&gt;KUBERNETES *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Kubernetes is an open-source container orchestration tool which helps in deployment of applications. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubernetes helps in scaling the applications among the users. It is a CD tool that helps in deployments &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It helps manage containerized applications in different deployment environments &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There are two types of services in Kubernetes. Deployment and Stateful services &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stateful services: It is a Kubernetes controller that manages multiple pods that have unique identities and are not interchangeable. In a stateful set each pod has a persistent, unique ID. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deployment set: the Deployment Controller changes the actual state to the desired state at a controlled rate. We can define Deployments to create new Replica Sets, or to remove existing Deployments and adopt all their resources with new Deployments. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stateful sets are generally used for databases and stateful applications because databases are generally hosted outside the Kubernetes cluster as a database can’t be replicated.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubernetes consists of the following components- pods, replica sets, services etc. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pods and replica sets are used to scale the application. It creates multiple instances of applications. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It load balances using load balancer and sends requests from users to the pods according to the load on different pods. Hence adjusts the traffic preventing the server or application from crashing &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have to create ‘yaml’ files to define the type of deployments, pods and replica sets &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have a create pods in template section to define the blue print of pods &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Minikube is a tool which lets us run Kubernetes locally. It runs on the node-kubernetes cluster &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Kubectl- It is a command line tool for k8s cluster.&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Whenever the pods gets destroyed, deployment will restore the pods with a different IP address &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generally, pods contain containers where the application is resided in the form of an image inside the container &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A pod can have one or more containers running inside it. Each container will be having different port numbers. Based on that the requests will be sent to respective containers from the service &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can define the number of instances of pods to be created in the section ‘replica sets’  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deployments are also used to roll back to previous versions of our applications. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;KUBERNETES SERVICES &lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
There are 4 types of services in Kubernetes &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Headless services&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Node port&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Load balancer &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cluster IP &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Need for services: *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When a pod dies, a new IP address is created for the pod. It becomes difficult to access the IP address for newly created pods.&lt;br&gt;
For each pod we set a service, service has a stable IP address pointing to the pod.&lt;br&gt;
Svc receives requests and forwards it to one of the pod &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CLUSTER IP&lt;/strong&gt;: It is a default type of service. When we create a svc without specifying the type it automatically takes cluster IP &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When a svc is created end points are created. K8s will use the endpoints to keep track which pods are members of svc. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selector in svc and label in pod should be same so that svc points to the pod. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Target port should be mentioned in svc. Target port and container port should be same. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;HEADLESS: *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If client wants to communicate with 1 specific pod directly, headless svc is used
&lt;/li&gt;
&lt;li&gt;Pods are not randomly selected by the svc &lt;/li&gt;
&lt;li&gt;Stateful apps like SQL, databases use headless services &lt;/li&gt;
&lt;li&gt;If client wants to communicate with a selected pod then the IP address of the pod should be known
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To achieve it, DNS lookup is used where it returns svc IP address to get pod IP address. If we set cluster IP address to none, pod IP address is returned. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cluster IP:&lt;/strong&gt; only accessible with in the cluster &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node port:&lt;/strong&gt; External traffic has access to fixed port on each worker node. The range of the port is 30000-32767 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Load Balancer:&lt;/strong&gt; becomes accessible externally through cloud provider. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;KUBECTL COMMANDS *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Kubectl appy -f &amp;lt;.yamlFile&amp;gt;: To create the resource from the file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl create -f  --edit -o json: edit the data in the file then creates the resource using the edited data. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl create deployment  --image=: creates a deployment with the specified image name. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl create deployment  --image=--replicas=3: creates a deployment with the specified image name and 3 replicas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl create deployment  --image= --port: : creates a deployment that runs on an image on the specified port number. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl delete deployment : to delete a deployment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl get deployments: displays list of created deployments .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl get svc: displays list of created services .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl get pods: displays list of pods .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl describe deployment : describes about the deployment in detail .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl describe svc : describes about the svc in detail .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl describe pod : describes about the pod in detail .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl get pod  -o wide: describes the pod with cluster IP address .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl rollout status deployment : gives the status of deployment .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl rollout history deployment  : gives the revisions of deployments .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kubectl rollout undo deployment  --to-revison=: goes back to the revised deployment.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>career</category>
      <category>hiring</category>
      <category>networking</category>
    </item>
    <item>
      <title>Every Git command a DevOps Engineer must know(Basic, Advanced)</title>
      <dc:creator>rohitreddyk33</dc:creator>
      <pubDate>Mon, 13 Feb 2023 05:08:07 +0000</pubDate>
      <link>https://forem.com/rohitreddyk33/every-git-command-a-devops-engineer-must-knowbasic-advanced-1f3j</link>
      <guid>https://forem.com/rohitreddyk33/every-git-command-a-devops-engineer-must-knowbasic-advanced-1f3j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Basic Git:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;git init:&lt;/strong&gt; Initializes an empty git repository &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;git add :&lt;/strong&gt; Adds the files into staging area &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;git commit :&lt;/strong&gt; Selects the changes which are staged for the next commit. &lt;/li&gt;
&lt;li&gt;git commit -a -m ""- commits the changes without the file being undergoing the staging area &lt;/li&gt;
&lt;li&gt;git remote add origin - adds the pathway from our local git to the remote repo. &lt;/li&gt;
&lt;li&gt;git remote set-url origin-To change the remote repo to another remote.
&lt;/li&gt;
&lt;li&gt;git remote -v- Displays the pathway of remote repo which the user has set. &lt;/li&gt;
&lt;li&gt;git config --global user.name "" - configures the username &lt;/li&gt;
&lt;li&gt;git config --global user.passsword "" - configures the password &lt;/li&gt;
&lt;li&gt;git config --global --edit - To edit the configured details &lt;/li&gt;
&lt;li&gt;git status - Shows the status of the files and displays whether the respective files are already staged,committed or yet to stage, commit &lt;/li&gt;
&lt;li&gt;git log- displays the log of the previous commits &lt;/li&gt;
&lt;li&gt;git log --oneline - displays the previous commits in one line with the starting 8 hashcode characters &lt;/li&gt;
&lt;li&gt;git diff  - shows the modifications and updations in the file between the commits &lt;/li&gt;
&lt;li&gt;git stash - stores our commit in a hidden place and we can make changes to the file prior that commit
&lt;/li&gt;
&lt;li&gt;git stash pop &amp;lt;{head-path}&amp;gt; - returns the previously stashed commit &lt;/li&gt;
&lt;li&gt;git log --merge- returns the list of commits which are causing merge conflicts &lt;/li&gt;
&lt;li&gt;git log --after:returns the commits done after the mentioned date &lt;/li&gt;
&lt;li&gt;git log --before:returns the commits done before the mentioned date &lt;/li&gt;
&lt;li&gt;git branch : Creates a new branch with the specified branch name &lt;/li&gt;
&lt;li&gt;git checkout : navigates and makes the head pointer points towards the specific branch &lt;/li&gt;
&lt;li&gt;git checkout -b : creates and navigates to the created branch &lt;/li&gt;
&lt;li&gt;git merge : Merges one branch with another branch &lt;/li&gt;
&lt;li&gt;fork: creates a copy of an existing repo in the user's remote repo &lt;/li&gt;
&lt;li&gt;git clone creates a copy of files of existing repo in the local repo of the user &lt;/li&gt;
&lt;li&gt;git push origin: lets you move local branch into the remote repository &lt;/li&gt;
&lt;li&gt;git pull origin: lets you move your remote branch into the local repo &lt;/li&gt;
&lt;li&gt;git fetch: downloads the copy of a branch from another repo but doesn't integrate it with your local repo &lt;/li&gt;
&lt;li&gt;ls : gives the list of files in the current working branch &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advanced Git:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git reset : undo's the changes made in the commit and puts it into staging area &lt;/li&gt;
&lt;li&gt;git reset --soft: undo's the changes made in the commit and puts them in non committed area &lt;/li&gt;
&lt;li&gt;git reset --hard:undo's the changes made in the respective commit and deletes the changes. Once used they are deleted permanantly.
&lt;/li&gt;
&lt;li&gt;git reset --mixed: It works the same as 'git reset' &lt;/li&gt;
&lt;li&gt;git merge --abort : aborts the merging process &lt;/li&gt;
&lt;li&gt;git merge --reset: undo's the merging process and puts back the commits in the state as they were before merging process &lt;/li&gt;
&lt;li&gt;git rebase -i HEAD~: deletes a specifc commit
&lt;/li&gt;
&lt;li&gt;git rebase --abort: aborts the deletion of a branch &lt;/li&gt;
&lt;li&gt;Git  rebase  : acts same as git merge but moves the commits of entire feature branch on top of the master branch &lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git rebase –i HEAD~ : interactive rebase helps in manipulating the commits. Ex: squash is used to combine two commits, reword is used to edit the commit message. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git revert: undo commits in a branch and creates a new commit  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find .git/objects -type f : displays the staged files present in git in the form of objects &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git cat-file –t : displays the type of object &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git cat-file –p : displays the content present in the object &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git gc –aggressive : performs compression on stored git objects freeing up disk space. It identifies a group of similar objects and compress them into a ‘pack’.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git verify-pack –v .git/objects/pack/pack: displays the contents of a pack  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git reflog : gives the history of everything done in local repo &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git reflog expire –-expire=now –-expire-unreachable=now –all: expire all entries to the reflog that are older than now &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git show : inspects a commit &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>devops</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Deploying a MERN application over Kubernetes</title>
      <dc:creator>rohitreddyk33</dc:creator>
      <pubDate>Mon, 30 Jan 2023 09:52:31 +0000</pubDate>
      <link>https://forem.com/rohitreddyk33/deploying-a-mern-application-using-kubernetes-48bl</link>
      <guid>https://forem.com/rohitreddyk33/deploying-a-mern-application-using-kubernetes-48bl</guid>
      <description>&lt;p&gt;Deploying a MERN(mongo-db, express, react-js, node-js) application using kubernetes.&lt;br&gt;
This is a simple authentication application where the users can Register and Login. The login details of the users are stored in mongo-db database.&lt;br&gt;
We are using React-js for the front end.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rohitreddyk33/dock"&gt;https://github.com/rohitreddyk33/dock&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
   Registration page using React-js. The requests are made through API calls. 
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import {React,useState} from 'react'

function Register() {
  const[name,setName]=useState('')
  const[email,setEmail]=useState('')
  const[password,setPassword]=useState('')



  async function registerUser(event){
    event.preventDefault()
  const response=await fetch('http://&amp;lt;your service name after creating a service yaml file&amp;gt;.default.svc.cluster.local:7070/api/register',{
      method:'POST',
      headers:{
        'Content-Type':'application/json',
      },
      body:JSON.stringify({
        name,email,password
      }),
    })
    const data=await response.json()
    console.log(data)


  }
  return (
   &amp;lt;div&amp;gt;
    &amp;lt;h1&amp;gt;register&amp;lt;/h1&amp;gt;
    &amp;lt;form onSubmit={registerUser}&amp;gt;
      &amp;lt;input type ="text" value={name} onChange={(e)=&amp;gt;setName(e.target.value)} placeholder="name"/&amp;gt;
      &amp;lt;input type ="email" value={email} onChange={(e)=&amp;gt;setEmail(e.target.value)} placeholder="email"/&amp;gt;
      &amp;lt;input type ="password" value={password} onChange={(e)=&amp;gt;setPassword(e.target.value)} placeholder="password"/&amp;gt;
      &amp;lt;input type="submit" value="register"/&amp;gt;
    &amp;lt;/form&amp;gt;
   &amp;lt;/div&amp;gt;

  )
  }

export default Register;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;Login page : If the users are already registered then they'll be able to view a page after logging in. Duplicate E-mails can't be used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { React, useState } from 'react'
import { useNavigate } from 'react-router-dom'

function Login() {
  const [email, setEmail] = useState('')
  const [password, setPassword] = useState('')

  const navigate=useNavigate()
  function loginUser(event) {
    event.preventDefault()
    fetch('http://&amp;lt;your service name after creating a service yaml file&amp;gt;.default.svc.cluster.local:7070/api/login', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        email, password
      }),
    }).then(res =&amp;gt;{
      return res.json();
    }).then(res =&amp;gt;{
      if(res.status==='ok'){
        localStorage.setItem('user',JSON.stringify(res))
      }

      navigate('/home')
    }) 
  }
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Login&amp;lt;/h1&amp;gt;
      &amp;lt;form onSubmit={loginUser}&amp;gt;
        &amp;lt;input type="email" value={email} onChange={(e) =&amp;gt; setEmail(e.target.value)} placeholder="email" /&amp;gt;
        &amp;lt;input type="password" value={password} onChange={(e) =&amp;gt; setPassword(e.target.value)} placeholder="password" /&amp;gt;
        &amp;lt;input type="submit" value="login" /&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;

  )
}

export default Login;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;A basic home page after logging in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

function Home() {
  return (
    &amp;lt;div&amp;gt;Welcome User&amp;lt;/div&amp;gt;
  )
}

export default Home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Creating a schema and collection in the mongo-db database with the help of express&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const mongoose=require('mongoose')
const User=new mongoose.Schema(
    {
    name:{type:String,required:true},
    email:{type:String,required:true,unique:true},
    password:{type:String,required:true},
    quote:{type:String},

},
{collection:'userdata'}
)
const model=mongoose.model('userdata',User)
module.exports=model
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;We are using Node-js for backend. It receives the requests from users and performs functions accordingly. It also authenticates users through jwt authentication where it generates Tokens for the users.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express')
const app = express()
const cors = require('cors')
const User = require('./models/model')
const jwt = require('jsonwebtoken');
app.use(express.json())
app.use(cors())
const mongoose = require('mongoose')
mongoose.connect("&amp;lt;your connection string which can be found in mongodb atlas after creating a cluster&amp;gt;")
 mongoose.connection.on('error', err =&amp;gt; {
     console.log(err);
  });


app.post('/api/register', async (req, res) =&amp;gt; {
    console.log(req.body)
    try {
        await User.create({
            name: req.body.name,
            email: req.body.email,
            password: req.body.password
        })
        res.json({ status: 'ok' })

    } catch (err) {
        res.json({ status: 'error', error: 'duplicate email' })
    }

}
)

app.post('/api/login', async (req, res) =&amp;gt; {
    const user = await User.findOne({
        email: req.body.email,
        password: req.body.password
    })
    console.log(user)
    if (user) {
        const token = jwt.sign({
            name: user.name,
            email: user.email

        },
            &amp;lt;Your secret key for tokenization&amp;gt;
        )
        console.log(token);
        const userToken={name:user.name,email:user.email,token}
        return res.json({"status":"ok",'user':userToken})
    }
    else {
        return res.json({ 'status': 'error', user: false })
    }
})


app.listen(7070, () =&amp;gt; {
    console.log("port 7070")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Creating deployment yaml files for back-end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: mern-node  
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mern-node
  template:
    metadata:
      labels:
        app: mern-node
    spec:
      containers:
      - name: mern-node
        image:(your repository in docker hub where you built and uploaded the Image of the back-end code)
        ports:
        - containerPort: 7070
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Creating deployment yaml files for front-end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: mern-react
  name: mern-react
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mern-react
  template:
    metadata:
      labels:
        app: mern-react
    spec:
      containers:
      - image: (your repository in docker hub where you built and uploaded the Image of the front-end code)
        name: mern-react
        ports:
        - containerPort: 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;creating a service file for back-end deployment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: node-service
spec:
  selector:
    app: mern-node
  type: ClusterIP
  ports:
  - port: 7070
    targetPort: 7070
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;creating a service file for front-end deployment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: node-service
spec:
  selector:
    app: mern-node
  type: ClusterIP
  ports:
  - port: 7070
    targetPort: 7070
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Access your application through the service port of the node-port&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;kubectl describe service mern-service&lt;/li&gt;
&lt;li&gt;Get the port number for the node-port &lt;/li&gt;
&lt;li&gt;localhost: "node-port port number"&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>mongodb</category>
      <category>react</category>
    </item>
  </channel>
</rss>
