Created
June 28, 2021 17:17
-
-
Save janeczku/a896ef27be4f9f29d7dc42a76d7aec70 to your computer and use it in GitHub Desktop.
Simple Kubernetes manifest to check connectivity between two pods running on different nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: test-server | |
labels: | |
app: test-server | |
spec: | |
terminationGracePeriodSeconds: 1 | |
containers: | |
- name: netshoot | |
image: nicolaka/netshoot | |
command: ["/bin/sh"] | |
args: ["-c", "while true; do nc -lv 8080 ; done"] | |
tolerations: | |
- key: "cattle.io/os" | |
operator: "Equal" | |
value: "linux" | |
effect: "NoSchedule" | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: ["test-client"] | |
topologyKey: "kubernetes.io/hostname" | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: test-server | |
labels: | |
app: test-server | |
spec: | |
ports: | |
- port: 8080 | |
protocol: TCP | |
selector: | |
app: test-server | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: test-client | |
labels: | |
app: client | |
spec: | |
terminationGracePeriodSeconds: 1 | |
containers: | |
- name: netshoot | |
image: nicolaka/netshoot | |
command: ["/bin/sh"] | |
args: ["-c", "while true; do nc -vz -w 5 test-server 8080; sleep 2;done"] | |
tolerations: | |
- key: "cattle.io/os" | |
operator: "Equal" | |
value: "linux" | |
effect: "NoSchedule" | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: ["test-server"] | |
topologyKey: "kubernetes.io/hostname" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment