Deploy Apache Web Server on Kubernetes Cluster Kodekloud

 


Solution: 

1. Create the namespace mentioned in the question

kubectl create ns httpd-namespace-xfusion

2. Create the deployment.yaml according to question configuration

vi deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deployment-xfusion
namespace: httpd-namespace-xfusion
labels:
app: httpd_app_xfusion
spec:
replicas: 2
selector:
matchLabels:
app: httpd_app_xfusion
template:
metadata:
labels:
app: httpd_app_xfusion
spec:
containers:
- name: httpd-container-xfusion
image: httpd:latest
ports:
- containerPort: 80

3. Create the service.yaml according to question configuration

vi service.yaml

apiVersion: v1
kind: Service
metadata:
name: httpd-service-xfusion
namespace: httpd-namespace-xfusion
spec:
type: NodePort
selector:
app: httpd_app_xfusion
ports:
- port: 80
targetPort: 80
nodePort: 30004

Finally apply 

kubectl apply -f .






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