Debug Running Pods
Ideally, you should set up observability so that manual debugging is not needed.
Opta provides 2 helpful commands to help with debugging:
opta logs -c hello.yaml
This will show you logs from all the running container for this service.
SSH into an instance
opta shell -c hello.yaml
This will open up a shell into one of the running container.
Opta uses kubernetes under the hood, so we recommend using the standard
kubectl for most debugging use cases. This page will give you
a brief tutorial on how to use this tool.
On mac, you can install it via:
brew install kubectl
More detailed instructions are available on the offical site
Before you can use
kubectl, you need to connect it to your kubernetes cluster
(created by opta). This is pretty simple in the Opta world! Just run:
# configure the kubeconfig file # note: if you don't want to use the default path $HOME/.kube/config, set the env var KUBECONFIG first opta configure-kubectl
By defaut opta use the default kube config file
~/.kube/config, if you want to use a different file set the
Kubernetes uses the word “pod” for containers[^1]. So every service will have one or more pods (as specified in your Opta yml as
You can see the pods for a given service by running:
kubectl get pods -n <service-name>
If this doesn’t show any pods, that means your service hasn’t been deployed. Check out the deployment docs to fix that.
<service-name> is specified in your yaml file:
modules: - name: hello # service-name type: k8s-service image: docker.io/kennethreitz/httpbin:latest
Opta supports a verbose debug state wherein the log level is set to debug, and the auto-generated terraform files and
directories are preserved after execution. This configuration serves for troubleshooting errors in deployment and
preserving the full terraform infrastructure as code for the archives or other reasons. To enable this state, simply
OPTA_DEBUG environment variables to some value like so:
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.