Unlike docker-compose sometimes kubectl provides you better tooling for docker container access.
Let me share with you my useful findings.
With port-forward, you can easily connect to pods service and debug it.
kubectl port-forward podname port
For example
kubectl port-forward sharepass-78d566f866-4dvv5 3000
kubectl port-forward sharepass-78d566f866–4dvv5 3000
Forwarding from 127.0.0.1:3000 -> 3000
Forwarding from [::1]:3000 -> 3000
Handling connection for 3000
Handling connection for 3000
This will forward port 3000 to localhost, so you can open URL http://localhost:3000 and enjoy access to your service.
This tool is helpful when you have a lot of k8s clusters for management.
https://github.com/ahmetb/kubectx
This tool will help you to install nice prompt with k8s cluster name and current context
https://github.com/jonmosco/kube-ps1
Originally published at blog.it-premium.com.ua.