
HTTP Application
This http-application.yaml manifest defines a Deployment and a corresponding Service to deploy and expose a hello-world application within a Kubernetes cluster.
Deployment - hello-world:
- Creates a Deployment named
hello-world. - Specifies one replica for the
hello-worldapplication. - Sets the selector to match pods labeled with app
: hello-world. - Defines a pod template labeled
app: hello-worldwith a container namedapprunning the specified Rails-basedhello-worldimage on port3000using the TCP protocol.
Service - hello-world:
- Creates a LoadBalancer-type Service named
hello-world. - Includes annotations for monitoring configurations, specifying the HTTP path
/, methodget, and protocolhttp. - Specifies the service type as LoadBalancer, enabling external access.
- Selects pods labeled with
app: hello-worldfor load balancing. - Exposes port
80using the TCP protocol and directs traffic to thewebtargetPort.
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: app
image: vcr.vngcloud.vn/60108-cuongdm3/rails-hello-world
ports:
- name: web
containerPort: 3000
protocol: TCP
---
kind: Service
apiVersion: v1
metadata:
name: hello-world
annotations:
vks.vngcloud.vn/monitor-http-path: "/"
vks.vngcloud.vn/monitor-http-method: "get"
vks.vngcloud.vn/monitor-protocol: "http"
spec:
type: LoadBalancer
selector:
app: hello-world
ports:
- name: http
protocol: TCP
port: 80
targetPort: web
kubectl apply -f http-application.yaml
\( \small{Monitor \space \space details} \)
kubectl get pods,svc -owide

Access the hello-world application via the public endpoint.
