Requirement:
We have many HTTP/HTTPS services inside K8S, some of them are with Cluster IP, so it is inconvient to test and access them from local laptop. ie we have livesql sandbox service on it and it is with cluster ip. We would like to test the url from my local laptop browserSolution:
- Install kubectl in your local laptop, refer link and set kubconfig file .Please refer Oracle OCI official doc
- Find the service details you would like to proxy out . ie livesqldb-service in namespace 'default'
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
livesqlsb-service ClusterIP 10.108.248.63 <none> 8888/TCP
- Understand how kubectl proxy works . Please refer my other note
- Run kubectl proxy on your laptop
$kubectl proxy --port=8099 &
- Open local browser to access it livesqlsb-service . The url format is like http://localhost:8099/api/v1/namespaces/<namespace>/services/http:<service name>:/proxy/ . In our case, it is http://localhost:8099/api/v1/namespaces/default/services/http:livesqlsb-service:8888/proxy/ords/f?p=590:1000
- We can use same concept to proxy out any web services in the K8S to the local laptop browser.
No comments:
Post a Comment