MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Kubernetes Service Example Programs

Here’s a complete YAML file that contains three Deployments and their corresponding Services:

  1. ClusterIP (default) for scmgalaxy/nginx-devopsschoolv1
  2. NodePort for scmgalaxy/nginx-devopsschoolv2
  3. LoadBalancer for rajeshmode/honda-gallery

Each container runs on port 80.

dasdsad
dsadsadsad
dsad
dsa
dsad
sa

โœ… Full Kubernetes YAML (deployment-and-services.yaml)

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-clusterip
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-clusterip
  template:
    metadata:
      labels:
        app: nginx-clusterip
    spec:
      containers:
      - name: nginx
        image: scmgalaxy/nginx-devopsschoolv1
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: nginx-clusterip-svc
spec:
  type: ClusterIP
  selector:
    app: nginx-clusterip
  ports:
  - port: 80
    targetPort: 80

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-nodeport
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-nodeport
  template:
    metadata:
      labels:
        app: nginx-nodeport
    spec:
      containers:
      - name: nginx
        image: scmgalaxy/nginx-devopsschoolv2
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: nginx-nodeport-svc
spec:
  type: NodePort
  selector:
    app: nginx-nodeport
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30080  # You can change this to a valid port range 30000โ€“32767

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: honda-loadbalancer
spec:
  replicas: 2
  selector:
    matchLabels:
      app: honda-loadbalancer
  template:
    metadata:
      labels:
        app: honda-loadbalancer
    spec:
      containers:
      - name: honda
        image: rajeshmode/honda-gallery
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: honda-loadbalancer-svc
spec:
  type: LoadBalancer
  selector:
    app: honda-loadbalancer
  ports:
  - port: 80
    targetPort: 80
Code language: PHP (php)

๐Ÿš€ Usage

To apply this YAML:

kubectl apply -f deployment-and-services.yaml
Code language: CSS (css)

You can then verify:

kubectl get all
Code language: JavaScript (javascript)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Kubernetes Deployment Explained: API Resource, YAML Example, and Use Cases

Fearture of Kubernetes Deployment Note:ReplicaSets = Replication+Controller in the Deployment Kubernetes Deployement Strategy Type of deployment .spec.strategy specifies the strategy used to replace old Pods by new…

Read More

Openshift Tutorials for DeploymentConfigs

OpenShift DeploymentConfigs are a core resource in OpenShift used to manage the deployment and lifecycle of applications. While Kubernetes uses Deployments to manage the rolling updates of…

Read More

Kubernetes Assignment and Project

Submit Answer in the www.Debug.School and share a URL in your Whatsapp Group. Day#1 Day#2 Day#3 Day#4 Day#5 Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps,…

Read More

Interview Questions & Answers Complete Guide for Kubernetes

Kubernetes What is Kubernetes? Why organizations are using it? What is a Kubernetes Cluster? Kubernetes Nodes What is a Node? What the master node is responsible for?…

Read More

Kubernetes Deployment Example Programs

Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have…

Read More

Azure Devops Pipeline YAML Example

This page shows a minimal Azure Pipelines YAML file that builds a Docker image with the Docker@2 task on a Microsoft-hosted Ubuntu agent each time code is…

Read More