Option 1: Directly viewing container logs
The pod ID is always the name of the container + a unique hash of that pod. In case you run multiple replicas you will have multiple pods, with the same beginning name (like "ghost") but different hashes.
You can get your pods ID by running
kubectl get pods -n namespace.
And then running
kubectl logs -f -n namespace ghost-847f89ddcf-5rbln to get a view of the containers standard input and output streams.
-f- follows the log and gives you a "live" view
-n- namespace of the pod, to view the logs of anything thats not in the default namespace you have to specify it
Optionally you can also add the '-p' flag, which will include logs of previous containers (when kubernetes autorestarts on a crash).
Option 2: Executing an interactive shell in the container/pod
Pod and container is used interchangeably
With this option you can access the container, like you would access a remote host per ssh.
kubectl exec -it -n namespace PODID -- bash
-it- stands for interactive, meaning output and input streams get piped to and from the executed program
bash- this can be anything really on the %PATH% variable of the container. Mostly you want to use
bash(upgraded shell) and if thats not available
Now we are "in" the container, like we ssh into a server. Notice that we aren't at "warmin" (my nodes hostname) anymore, but at "ghost-847f89ddcf-5rbln". Our container behaves like a separate machine would. Own package manager, system files, etc..
If you are interested in the inner workings of containers I would recommend the documentation at https://docs.docker.com/, as it is the leading container platform.