Skip to content

Instantly share code, notes, and snippets.

@SajidK25
Created October 25, 2025 12:35
Show Gist options
  • Select an option

  • Save SajidK25/e0c0cd28cf7eae6db67e7b3f3e1ee07b to your computer and use it in GitHub Desktop.

Select an option

Save SajidK25/e0c0cd28cf7eae6db67e7b3f3e1ee07b to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-deployment
namespace: sample-app
labels:
app: sample-app
spec:
replicas: 3
selector:
matchLabels:
app: sample-app
template:
metadata:
labels:
app: sample-app
spec:
containers:
- name: sample-app
image: nginx:1.27.4
ports:
- name: http
containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: sample-service
namespace: sample-app
labels:
app: sample-app
spec:
type: NodePort
selector:
app: sample-app
ports:
- protocol: TCP
port: 80
targetPort: 80 # Corrected from 8080
nodePort: 30080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment