Difference between revisions of "Kubernetes Hairpin-Proxy"
Jump to navigation
Jump to search
| (3 intermediate revisions by the same user not shown) | |||
| Line 26: | Line 26: | ||
kubectl expose pod nginx-ingress-microk8s-controller-86rjl --type=NodePort --port=8080 -n ingress | kubectl expose pod nginx-ingress-microk8s-controller-86rjl --type=NodePort --port=8080 -n ingress | ||
| + | ``` | ||
| + | |||
| + | Pods are up now | ||
| + | ``` | ||
| + | root@km1:~/src/hairpin-proxy# k get pods -n hairpin-proxy -o wide | ||
| + | NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES | ||
| + | hairpin-proxy-controller-7b48d47458-xlzrt 1/1 Running 5 174m 10.1.132.196 km1 <none> <none> | ||
| + | hairpin-proxy-haproxy-5c8b4c9cf-84n6j 1/1 Running 0 19m 10.1.132.205 km1 <none> <none> | ||
| + | ``` | ||
| + | |||
| + | Let's try and see if it works | ||
| + | ``` | ||
| + | root@km1:~/src/hairpin-proxy# k get svc --all-namespaces | grep hair | ||
| + | hairpin-proxy hairpin-proxy ClusterIP 10.152.183.106 <none> 80/TCP,443/TCP 165mm | ||
| + | |||
| + | / # host minimal.uvoo.io | ||
| + | minimal.uvoo.io has address 10.152.183.106 | ||
| + | |||
| + | Works from outside host | ||
| + | ~$ curl -L -k -H "Host: minimal.uvoo.io" https://km1 | ||
| + | Hello, world! | ||
| + | Version: 2.0.0 | ||
| + | Hostname: exampleservice-7b8db6b8b-qs6mz | ||
| + | |||
| + | |||
| + | but curl hangs in test container | ||
| + | curl -k http://minimal.uvoo.io | ||
``` | ``` | ||
Latest revision as of 00:25, 15 February 2021
Trying to get this to work on microk8s
https://github.com/compumike/hairpin-proxy
kubectl apply -f https://raw.githubusercontent.com/compumike/hairpin-proxy/v0.1.2/deploy.yml
kubectl get configmap -n kube-system coredns -o=jsonpath='{.data.Corefile}'
Still doesn't work
kubectl get svc -n ingress | grep ingress
output: nginx-ingress-microk8s-controller-86rjl.ingress.svc.cluster.local
kubectl edit deploy hairpin-proxy-haproxy -n hairpin-proxy
# Modify with below
spec:
containers:
- env:
- name: TARGET_SERVER
value: nginx-ingress-microk8s-controller-86rjl.ingress.svc.cluster.local
image: compumike/hairpin-proxy-haproxy:0.1.2
kubectl expose pod nginx-ingress-microk8s-controller-86rjl --type=NodePort --port=8080 -n ingress
Pods are up now
root@km1:~/src/hairpin-proxy# k get pods -n hairpin-proxy -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES hairpin-proxy-controller-7b48d47458-xlzrt 1/1 Running 5 174m 10.1.132.196 km1 <none> <none> hairpin-proxy-haproxy-5c8b4c9cf-84n6j 1/1 Running 0 19m 10.1.132.205 km1 <none> <none>
Let's try and see if it works
root@km1:~/src/hairpin-proxy# k get svc --all-namespaces | grep hair hairpin-proxy hairpin-proxy ClusterIP 10.152.183.106 <none> 80/TCP,443/TCP 165mm / # host minimal.uvoo.io minimal.uvoo.io has address 10.152.183.106 Works from outside host ~$ curl -L -k -H "Host: minimal.uvoo.io" https://km1 Hello, world! Version: 2.0.0 Hostname: exampleservice-7b8db6b8b-qs6mz but curl hangs in test container curl -k http://minimal.uvoo.io