This site is archived

Posit Connect support for off-host content execution has entered General Availability (GA).
Documentation about off-host execution is now included in the Connect Admin Guide.
The instructions presented here were associated with the off-host execution beta and are now obsolete.

Debugging Posit Connect

Debugging Posit Connect

If your Posit Connect pod is failing to start, use the kubectl describe command to get dianostic information about the Posit Connect pod.

Command:

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

The pod’s Events may 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

It may also be necessary to check the logs of the failed container. This can be done with the following command:

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

In Posit Connect’s logs, we can see that the container is failing to start because Posit 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

Filing a Support Request

If you have a support plan with Posit and would like to file a ticket to get help with your Posit Connect deployment on Kubernetes, please execute the following script and attach the results to your ticket.

Note

Using this script requires that the deployment was previously created by running the helm upgrade --install ... command.

#!/usr/bin/env bash
# Copyright (C) 2020 by Posit Software, PBC.

set -euxo pipefail

NAMESPACE="${1:-rstudio-connect}"
RELEASE_NAME=$(helm list -n $NAMESPACE -o yaml | grep "chart: rstudio-connect-[0-9]" -A1 | grep name | awk '{print $2}')

echo "### Kubernetes version ###"
kubectl version
echo

echo "### Helm version ###"
helm version
echo

echo "### Helm releases (namespace: $NAMESPACE) ###"
helm list -n $NAMESPACE
echo

echo "### values.yaml (release: $RELEASE_NAME) ###"
helm get values -n $NAMESPACE $RELEASE_NAME | grep -v "Password:"
echo

echo "### Posit Connect Pod describe ###"
kubectl describe pod -n $NAMESPACE -l app.kubernetes.io/name=rstudio-connect
echo

echo "### Posit Connect server logs ###"
kubectl logs -n $NAMESPACE $(kubectl get pod -n $NAMESPACE -l app.kubernetes.io/name=rstudio-connect -o=jsonpath='{.items[0].metadata.name}')
  1. Save the above script to a file called run-diagnostics-k8s.sh
  2. Make the script executable: chmod 750 ./run-diagnostics-k8s.sh
  3. Invoke the script and save the output to a file: ./run-diagnostics-k8s.sh > rsc-diagnostic-info-k8s.txt
Note

Note that this script accepts 1 optional argument which can be used to provide a namespace other than the default, rstudio-connect. Use a command like the following to invoke the script with a non-default namespace: ./run-diagnostics-k8s.sh my-custom-namespace > rsc-diagnostic-info-k8s.txt

  1. Attach the output file rsc-diagnostic-info-k8s.txt to your support ticket.