Last active
March 28, 2025 14:02
-
-
Save PhilipSchmid/40523963214fb1b0cdf26fd8b46dfffb to your computer and use it in GitHub Desktop.
Two Goldpinger DaemonSets (in two different namespaces) to test K8s Pod-to-Pod connectivity
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
# https://github.com/bloomberg/goldpinger | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: goldpinger1 | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: goldpinger2 | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: goldpinger-view-pods | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: view | |
subjects: | |
- kind: ServiceAccount | |
name: goldpinger-serviceaccount | |
namespace: goldpinger1 | |
- kind: ServiceAccount | |
name: goldpinger-serviceaccount | |
namespace: goldpinger2 | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: goldpinger-serviceaccount | |
namespace: goldpinger1 | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: goldpinger-serviceaccount | |
namespace: goldpinger2 | |
--- | |
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: goldpinger1 | |
namespace: goldpinger1 | |
labels: | |
app: goldpinger | |
spec: | |
updateStrategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxUnavailable: 10 | |
selector: | |
matchLabels: | |
app: goldpinger | |
template: | |
metadata: | |
annotations: | |
prometheus.io/scrape: 'true' | |
prometheus.io/port: '8080' | |
labels: | |
app: goldpinger | |
spec: | |
serviceAccount: goldpinger-serviceaccount | |
tolerations: | |
- key: node-role.kubernetes.io/master | |
effect: NoSchedule | |
- key: node-role.kubernetes.io/control-plane | |
effect: NoSchedule | |
- key: node-role.kubernetes.io/infra | |
effect: NoSchedule | |
securityContext: | |
runAsNonRoot: true | |
runAsUser: 1000 | |
fsGroup: 2000 | |
containers: | |
- name: goldpinger | |
env: | |
- name: HOST | |
value: "0.0.0.0" | |
- name: PORT | |
value: "8080" | |
# injecting real hostname will make for easier to understand graphs/metrics | |
- name: HOSTNAME | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
# podIP is used to select a randomized subset of nodes to ping. | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
- name: NAMESPACE | |
value: "" | |
- name: HOSTS_TO_RESOLVE | |
value: "api.github.com www.google.com" | |
- name: HTTP_TARGETS | |
value: "http://login.microsoft.com http://www.google.com" | |
- name: TCP_TARGETS | |
value: "goldpinger.goldpinger2.svc.cluster.local.:8080" | |
image: bloomberg/goldpinger:3.10.2 | |
imagePullPolicy: Always | |
securityContext: | |
allowPrivilegeEscalation: false | |
readOnlyRootFilesystem: true | |
resources: | |
limits: | |
memory: 80Mi | |
requests: | |
cpu: 1m | |
memory: 40Mi | |
ports: | |
- containerPort: 8080 | |
name: http | |
readinessProbe: | |
httpGet: | |
path: /healthz | |
port: 8080 | |
initialDelaySeconds: 20 | |
periodSeconds: 5 | |
livenessProbe: | |
httpGet: | |
path: /healthz | |
port: 8080 | |
initialDelaySeconds: 20 | |
periodSeconds: 5 | |
--- | |
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: goldpinger2 | |
namespace: goldpinger2 | |
labels: | |
app: goldpinger | |
spec: | |
updateStrategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxUnavailable: 10 | |
selector: | |
matchLabels: | |
app: goldpinger | |
template: | |
metadata: | |
annotations: | |
prometheus.io/scrape: 'true' | |
prometheus.io/port: '8080' | |
labels: | |
app: goldpinger | |
spec: | |
serviceAccount: goldpinger-serviceaccount | |
tolerations: | |
- key: node-role.kubernetes.io/master | |
effect: NoSchedule | |
- key: node-role.kubernetes.io/control-plane | |
effect: NoSchedule | |
- key: node-role.kubernetes.io/infra | |
effect: NoSchedule | |
securityContext: | |
runAsNonRoot: true | |
runAsUser: 1000 | |
fsGroup: 2000 | |
containers: | |
- name: goldpinger | |
env: | |
- name: HOST | |
value: "0.0.0.0" | |
- name: PORT | |
value: "8080" | |
# injecting real hostname will make for easier to understand graphs/metrics | |
- name: HOSTNAME | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
# podIP is used to select a randomized subset of nodes to ping. | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
- name: NAMESPACE | |
value: "" | |
- name: HOSTS_TO_RESOLVE | |
value: "api.github.com www.google.com" | |
- name: HTTP_TARGETS | |
value: "http://login.microsoft.com http://www.google.com" | |
- name: TCP_TARGETS | |
value: "goldpinger.goldpinger1.svc.cluster.local.:8080" | |
image: bloomberg/goldpinger:3.10.2 | |
imagePullPolicy: Always | |
securityContext: | |
allowPrivilegeEscalation: false | |
readOnlyRootFilesystem: true | |
resources: | |
limits: | |
memory: 80Mi | |
requests: | |
cpu: 1m | |
memory: 40Mi | |
ports: | |
- containerPort: 8080 | |
name: http | |
readinessProbe: | |
httpGet: | |
path: /healthz | |
port: 8080 | |
initialDelaySeconds: 20 | |
periodSeconds: 5 | |
livenessProbe: | |
httpGet: | |
path: /healthz | |
port: 8080 | |
initialDelaySeconds: 20 | |
periodSeconds: 5 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: goldpinger | |
namespace: goldpinger1 | |
labels: | |
app: goldpinger | |
spec: | |
type: LoadBalancer | |
ports: | |
- port: 8080 | |
name: http | |
selector: | |
app: goldpinger | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: goldpinger | |
namespace: goldpinger2 | |
labels: | |
app: goldpinger | |
spec: | |
type: LoadBalancer | |
ports: | |
- port: 8080 | |
name: http | |
selector: | |
app: goldpinger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment