HackerRank DevOps Interview Solution of Kubernetes: Basic Redis Deployment

 HackerRank DevOps Interview Solution of Kubernetes: Basic Redis Deployment

 

Kubernetes: Basic Redis Deployment

QUESTION DESCRIPTION

A company wants to deploy a web application has built on Kubernetes.  As part of that process, complete a file stub "/home/ubuntu/1091251-kubernetes-basic-redis-deployment/definition.yml" with one or more steps that do the following:

  • Creates a new namespace "hacker-company".
  • Deploys a new "redis" image (from Dockerhub) on the "buster" tag as "redis" deployment, in the "hacker-company" namespace.
  • Increases the pods number of the "redis" deployment up to 2 replicas.
  • Exposes "6379" port of the "redis" containers.

Note

  • The completed solution will be evaluated in a new, clean environment. Be sure everything is in the "/home/ubuntu/1091251-kubernetes-basic-redis-deployment" folder.
  • All the tasks should be done within a simple "sudo solve" execution invoked from the question directory.
  • You have sudo access.

Grading

  • The execution result of "sudo solve" invoked from the question directory solves the task.

 

                            Download These Books to Get HackerRank Interview Solution 

 
Solution:

At first ssh into the server

ssh [email protected]

Then type ls and go to kubernetes redis deployment folder

You can see a definition.yml here. Edit it

vi definition.yml

apiVersion: v1
kind: Namespace
metadata:
name: hacker-company
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: hacker-company
labels:
app: redis
spec:
selector:
matchLabels:
app: redis
replicas: 2
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:buster
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: hacker-company
spec:
selector:
app: redis
ports:
- protocol: "TCP"
port: 6379
type: ClusterIP

Then finally run the mentioned command

sudo solve

                       Download These Books to Get HackerRank Interview Solution 

 

 

 

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment