Skip to content

Instantly share code, notes, and snippets.

@miry
Last active September 16, 2020 12:44
Show Gist options
  • Save miry/38db62ec3d786e7ccb43d60572923692 to your computer and use it in GitHub Desktop.
Save miry/38db62ec3d786e7ccb43d60572923692 to your computer and use it in GitHub Desktop.
Example how to deploy and benchmark of K8S networks
---
apiVersion: v1
kind: Service
metadata:
name: iperf3-server-host-cluster-ip
labels:
app: iperf3-server-host-cluster-ip
spec:
# ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. This is the default ServiceType.
type: ClusterIP
ports:
- name: iperf3-port
protocol: TCP
port: 5201
targetPort: 5201
selector:
app: iperf3-server-host
---
apiVersion: v1
kind: Service
metadata:
name: iperf3-server-host-node-port
labels:
app: iperf3-server-host-node-port
spec:
# NodePort: Exposes the service on each Node’s IP at a static port (the NodePort). A ClusterIP service, to which the NodePort service will route, is automatically created. You’ll be able to contact the NodePort service, from outside the cluster, by requesting <NodeIP>:<NodePort>
type: NodePort
ports:
- name: iperf3-port
protocol: TCP
port: 5201
targetPort: 5201
selector:
app: iperf3-server-host
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: iperf3-server-host
namespace: default
spec:
replicas: 1
revisionHistoryLimit: 20
selector:
matchLabels:
app: iperf3-server-host
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: iperf3-server-host
name: iperf3-server-host
spec:
hostNetwork: true
containers:
- args:
- -s
image: networkstatic/iperf3
imagePullPolicy: Always
name: iperf3-server-host
resources: {}
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: iperf3-server-cluster-ip
labels:
app: iperf3-server-cluster-ip
spec:
# ClusterIP: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. This is the default ServiceType.
type: ClusterIP
ports:
- name: iperf3-port
protocol: TCP
port: 5201
targetPort: 5201
selector:
app: iperf3-server
---
apiVersion: v1
kind: Service
metadata:
name: iperf3-server-node-port
labels:
app: iperf3-server-node-port
spec:
# NodePort: Exposes the service on each Node’s IP at a static port (the NodePort). A ClusterIP service, to which the NodePort service will route, is automatically created. You’ll be able to contact the NodePort service, from outside the cluster, by requesting <NodeIP>:<NodePort>
type: NodePort
ports:
- name: iperf3-port
protocol: TCP
port: 5201
targetPort: 5201
selector:
app: iperf3-server
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: iperf3-server
namespace: default
spec:
replicas: 1
revisionHistoryLimit: 20
selector:
matchLabels:
app: iperf3-server
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: iperf3-server
name: iperf3-server
spec:
containers:
- args:
- -s
image: networkstatic/iperf3
imagePullPolicy: Always
name: iperf3-server
resources: {}
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment