Skip to content

Instantly share code, notes, and snippets.

@weinong
Created August 18, 2020 21:52
Show Gist options
  • Select an option

  • Save weinong/0380c0bf1819e2fb87ec24e6ef6213b1 to your computer and use it in GitHub Desktop.

Select an option

Save weinong/0380c0bf1819e2fb87ec24e6ef6213b1 to your computer and use it in GitHub Desktop.
simple udp on k8s
FROM alpine
RUN apk add --no-cache netcat-openbsd
ENTRYPOINT [ "nc" ]
apiVersion: apps/v1
kind: Deployment
metadata:
name: netcat
spec:
replicas: 1
selector:
matchLabels:
app: netcat
template:
metadata:
labels:
app: netcat
spec:
containers:
- name: netcat
image: weinong/netcat:latest
imagePullPolicy: Always
args:
- "-lkuv"
- "9000"
ports:
- name: nc
containerPort: 9000
protocol: UDP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: netcat-lb
name: netcat-lb
namespace: default
spec:
ports:
- name: nc
port: 9000
protocol: UDP
targetPort: 9000
sessionAffinity: None
selector:
app: netcat
type: LoadBalancer
status:
loadBalancer: {}
for i in {1..100}; do echo $i | nc -uvc 52.161.184.63 9000; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment