Skip to content

Instantly share code, notes, and snippets.

@muhammad-asn
Created April 28, 2025 03:43
Show Gist options
  • Save muhammad-asn/0a239b2a9c8b9d52d5e96c43939075ee to your computer and use it in GitHub Desktop.
Save muhammad-asn/0a239b2a9c8b9d52d5e96c43939075ee to your computer and use it in GitHub Desktop.
Test UDP and TCP Connection in Kubernetes
## TCP Connection
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: monitoring
spec:
type: ClusterIP
selector:
app: nginx
ports:
- port: 8125
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
## UDP Connection
# Reference: https://hub.docker.com/r/cilium/echoserver-udp
apiVersion: v1
kind: Service
metadata:
name: echoserver-udp-service
namespace: monitoring
spec:
type: ClusterIP
selector:
app: echoserver-udp
ports:
- port: 8125
targetPort: 8125
protocol: UDP
name: echoserver-udp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver-udp
namespace: monitoring
labels:
app: echoserver-udp
spec:
replicas: 1
selector:
matchLabels:
app: echoserver-udp
template:
metadata:
labels:
app: echoserver-udp
spec:
containers:
- name: echoserver-udp
image: quay.io/cilium/echoserver-udp
command: ["echoserver-tftp"]
args: ["-listen", ":8125"]
ports:
- containerPort: 8125
protocol: UDP
name: echoserver-udp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment