Pods are composed of one or more containers; as such, you have the ability to gain access within a container using the kubectl exec -it [pod] (-c [container]) (-n [namespace]) bin/bash
If you’re trying to gain access to the node instead, use ssh followed by the username@node_host
I tried below commands still not able to login as a root user id , please suggest!!
kubectl exec -it [pod name] (-c [container name]) (-n [namespace]) bin/bash
kubectl exec -it [pod name] (-c [container name]) (-n [namespace]) bin/sh
kubectl exec -it [pod name] (-c [container name]) (-n [namespace]) – sh
HEMAN.MALVE@BLRKEC397481L MINGW64 /d/HEMAN.MALVE/Database/Projects/P&G
$ ./kubectl -n kong-postgres-new exec -it ingress-kong-5f54bf5c8-r9zgk -c proxy bin/sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] – [COMMAND] instead.
Unable to use a TTY - input is not a terminal or the right kind of file
whoami
kong
id kong
uid=100(kong) gid=65533(nogroup) groups=65533(nogroup),65533(nogroup)
id root
uid=0(root) gid=0(root) groups=0(root),0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
exit
HEMAN.MALVE@BLRKEC397481L MINGW64 /d/HEMAN.MALVE/Database/Projects/P&G
$ ./kubectl -n kong-postgres-new exec -it ingress-kong-5f54bf5c8-r9zgk -c proxy bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] – [COMMAND] instead.
Unable to use a TTY - input is not a terminal or the right kind of file
whoami
kong
id root
uid=0(root) gid=0(root) groups=0(root),0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)