-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest-connections.sh
More file actions
executable file
·49 lines (40 loc) · 1.9 KB
/
test-connections.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
proxy_pod_name=$(kubectl get pods -n cortexflow --no-headers -o custom-columns=":metadata.name" | grep cortexflow-proxy)
proxy_ip=$(kubectl get -o template service/proxy-service -n cortexflow --template='{{.spec.clusterIP}}')
proxy_udp_port=5053
proxy_tcp_port=5054
proxy_metrics_port=9090
proxy_container=$(kubectl get pod $proxy_pod_name -n cortexflow -o jsonpath='{.spec.containers[*].name}')
echo "🧑🏻🔬 Checking cortexflow proxy inside the proxy pod: $proxy_pod_name"
sleep 1.5
echo "🔨 checking env variables"
kubectl exec -n cortexflow $proxy_pod_name -- env
sleep 1.5
./install-debugging-tools.sh $proxy_pod_name $proxy_container
echo
./test-proxy-ports.sh $proxy_pod_name $proxy_metrics_port
echo
sleep 1.5
echo "🔨 Sending a test package with netcat from proxy pod -> proxy pod"
kubectl exec -n cortexflow $proxy_pod_name -- sh -c echo b"Hi CortexFlow" | nc -u -w5 -v 127.0.0.1 $proxy_udp_port
echo
sleep 1.5
echo "🔨 Testing the DNS resolution manually with nslookup"
kubectl exec -n cortexflow $proxy_pod_name -- nslookup proxy-service.cortexflow.svc.cluster.local
sleep 1.5
echo
./test-proxy-endpoints.sh $proxy_pod_name
echo
echo
echo "🧑🏻🔬 Testing outside the proxy pod using a test pod"
echo "🔨 Testing using a temporary test pod and nslookup"
kubectl run -it --rm --image=busybox test-pod --restart=Never -n cortexflow -- nslookup proxy-service.cortexflow.svc.cluster.local
echo
sleep 1.5
echo "🔨 Sending a test message using netcat and a temporary test pod"
kubectl run -it --rm --image=busybox test-pod --restart=Never -n cortexflow -- sh -c "echo -n Hi CortexFlow | nc -u -w 3 -v $proxy_ip $proxy_udp_port"
echo
sleep 1.5
echo "🔨 Testing the tcp port"
echo "🔨 Sending a test message using netcat and a temporary test pod "
kubectl run -it --rm --image=busybox test-pod --restart=Never -n cortexflow -- sh -c "echo -n Hi TCP | nc -w 3 -v $proxy_ip $proxy_tcp_port"