Debugging

Startup Failure

If your Posit Connect pod is failing to start, use the kubectl describe command to get its diagnostic information:

kubectl describe pod -l app.kubernetes.io/name=rstudio-connect

It’s possible for the pod’s Events to indicate an error. In this case, we can see that the Posit Connect pod is failing to start and Kubernetes is repeatedly attempting to restart it.

Name:         connect-rstudio-connect-79f459f647-8rxzd
...
Events:
  Type     Reason       Age                   From               Message
  ----     ------       ----                  ----               -------
  Normal   Scheduled    4m12s                 default-scheduler  Successfully assigned rsc-dev/connect-rstudio-connect-79f459f647-8rxzd to docker-desktop
  Warning  FailedMount  4m12s                 kubelet            MountVolume.SetUp failed for volume "graphite-exporter-config" : failed to sync configmap cache: timed out waiting for the condition
  Warning  FailedMount  4m12s                 kubelet            MountVolume.SetUp failed for volume "rstudio-connect-config" : failed to sync configmap cache: timed out waiting for the condition
  Normal   Pulled       4m9s                  kubelet            Container image "prom/graphite-exporter:v0.9.0" already present on machine
  Normal   Created      4m9s                  kubelet            Created container exporter
  Normal   Started      4m8s                  kubelet            Started container exporter
  Normal   Pulled       3m24s (x4 over 4m9s)  kubelet            Container image "rstudio/rstudio-connect:1.8.6.2" already present on machine
  Normal   Created      3m24s (x4 over 4m9s)  kubelet            Created container connect
  Normal   Started      3m24s (x4 over 4m9s)  kubelet            Started container connect
  Warning  BackOff      2m44s (x8 over 4m5s)  kubelet            Back-off restarting failed container

If the container fails, you can check the logs of the failed container. This can be done with the following command:

kubectl logs -f --tail 50 \
    -l app.kubernetes.io/name=rstudio-connect \
    --container connect

In Connect’s logs, we can see that the container is failing to start because Connect cannot reach our Postgres database:

2021/08/04 17:54:55 Configuring licensing to use a local license...
2021/08/04 17:54:55 Using the normalized Server.Address: https://connect.rstudio.com/
2021/08/04 17:54:56 Detected Python version 3.6.5 at /opt/python/3.6.5/bin/python3.6
2021/08/04 17:54:56 Detected R version 3.6.2 at /opt/R/3.6.2/bin/R
2021/08/04 17:54:56 Detected R version 3.6.2 at /opt/R/3.6.2/lib/R/bin/R
2021/08/04 17:54:56 Error: Unable to initialize a connection to the core database: Unable to connect to core DB: dial tcp: lookup postgres.rstudio.com on 10.96.0.10:53: no such host
Deactivating license ...
+ deactivate
+ echo 'Deactivating license ...'
+ /opt/rstudio-connect/bin/license-manager deactivate