concept kubectl exec in category kubernetes

This is an excerpt from Manning's book Kubernetes in Action.
You can execute the curl command inside one of your existing pods through the kubectl exec command.
The kubectl exec command allows you to remotely run arbitrary commands inside an existing container of a pod. This comes in handy when you want to examine the contents, state, and/or environment of a container. List the pods with the kubectl get pods command and choose one as your target for the exec command (in the following example, I’ve chosen the kubia-7nog1 pod as the target). You’ll also need to obtain the cluster IP of your service (using kubectl get svc, for example). When running the following commands yourself, be sure to replace the pod name and the service IP with your own:
$ kubectl exec kubia-7nog1 -- curl -s http://10.111.249.153 You've hit kubia-gzwli !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":59}]]"} !@%STYLE%@!If you’ve used ssh to execute commands on a remote system before, you’ll recognize that kubectl exec isn’t much different.
Let’s see what those environment variables look like by examining the environment of one of your running pods. You’ve already learned that you can use the kubectl exec command to run a command in the pod, but because you created the service only after your pods had been created, the environment variables for the service couldn’t have been set yet. You’ll need to address that first.