smart48 / larak8

DigitalOcean Kubernetes Deployment of Laravel App
2 stars 3 forks source link

Access Containers in Pod #9

Closed jasperf closed 3 years ago

jasperf commented 3 years ago

Need to add details on how to access containers inside pods so we can run commands inside them manually when need be.

jasperf commented 3 years ago

We can using exec followed by pod name, namespace and container name

kubectl exec -it localweb-5fcbfb587-f7tzh  -n smt-local -c nginx  -- /bin/bash
bash-5.0# ll
bash: ll: command not found
bash-5.0# ls
bin                   etc                   mnt                   run                   tmp
dev                   home                  opt                   sbin                  usr
docker-entrypoint.d   lib                   proc                  srv                   var
docker-entrypoint.sh  media                 root                  sys
bash-5.0# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful