Skip to content

Instantly share code, notes, and snippets.

@Thakurvaibhav
Last active February 4, 2024 15:35
Show Gist options
  • Save Thakurvaibhav/6514f4b374cd419a39382d8de1c2d6c7 to your computer and use it in GitHub Desktop.
Save Thakurvaibhav/6514f4b374cd419a39382d8de1c2d6c7 to your computer and use it in GitHub Desktop.
Demo Nginx Deployment and Service Manifest
apiVersion: v1
kind: Namespace
metadata:
name: nginx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: nginx
name: nginx-deployment
spec:
replicas: 1
template:
metadata:
annotations:
prometheus.io/path: "/status/format/prometheus"
prometheus.io/scrape: "true"
prometheus.io/port: "80"
labels:
app: nginx-server
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx-server
topologyKey: kubernetes.io/hostname
containers:
- name: nginx-demo
image: vaibhavthakur/nginx-demo:1.0-SNAPSHOT
imagePullPolicy: Always
resources:
limits:
cpu: 2500m
requests:
cpu: 2000m
ports:
- containerPort: 80
name: http
---
apiVersion: v1
kind: Service
metadata:
namespace: nginx
name: nginx-service
annotations:
cloud.google.com/load-balancer-type: Internal
spec:
ports:
- port: 80
targetPort: 80
name: http
selector:
app: nginx-server
type: LoadBalancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment