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 .
0 comments:
Post a Comment