Troubleshooting

Recovering lost access details and resetting access key

You can manually recover your endpoint URL and access key as well as reset your access key using kubectl commands.

Do not rely on these commands for automation purposes (e.g. changing access keys automatically at a predetermined interval), since the internal details of the relevant Kubernetes objects are not guaranteed to remain stable across different versions of Scalable Pixel Streaming.

Configure the kubectl tool

Before proceeding, you will first need to configure the kubectl tool to access your Kubernetes cluster.

Recovering the endpoint URL

To retrieve the endpoint URL of your REST API server, you will need to query the Kubernetes ingress object used to expose access to the REST API to clients running outside of the Kubernetes cluster:

# Retrieve the details of the ingress for the REST API
kubectl get ingresses.networking.k8s.io sps-api

# The output will look similar to this:
NAME                 CLASS    HOSTS              ADDRESS   PORTS   AGE
sps-api   <none>   some.domain.name   1.2.3.4   80      1m

Although the same fields will always be printed regardless of the cloud platform that Scalable Pixel Streaming is installed on, the value that represents the endpoint URL will vary across different cloud platforms:

  • On cloud platforms where the HOSTS field has a non-empty value, this domain name is the endpoint URL.
  • On cloud platforms where the HOSTS field is empty, the value in the ADDRESS field (which could be either a domain name or an IP address) is the endpoint URL.

Recovering the access key

You can retrieve the access key for the REST API by decrypting the contents of the Kubernetes secret object that contains it. Note that the value is encoded using Base64, so you will need to decode it using the appropriate command for your operating system.

Run this command under Linux and macOS to decrypt the secret and decode it:

# Decrypt the value of the REST API access key and decode its Base64 representation
kubectl get secrets/sps-api-access-key --template={{.data.restapiaccesskey}} | base64 -d

The same is achieved on Windows by running these commands in PowerShell:

# Decrypt the value of the REST API access key and store it
$base64 = (kubectl get secrets/sps-api-access-key --template={{.data.restapiaccesskey}})
# Decode the base64 representation
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64))

Resetting the access key

To reset the access key, you will need to create a new secret object and then restart the REST API server to ensure it detects the updated access key.

Use these commands under Linux and macOS:

# Generate and store a new random value for the access key
newRestApiAccessKey=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32`

# Delete the existing Secret for the Access Key
kubectl delete secret sps-api-access-key --ignore-not-found

# Create the new secret
kubectl create secret generic sps-api-access-key --from-literal=restapiaccesskey=$newRestApiAccessKey
kubectl label secrets sps-api-access-key app.kubernetes.io/managed-by=Helm

# Restart the REST API server
kubectl rollout restart deployment sps-api

# Print the new access key value for confirmation
echo "The new REST API access key is: $newRestApiAccessKey"

Use these commands in PowerShell under Windows:

# Generate and store a new random value for the access key
$newRestApiAccessKey = -join ((65..90) + (97..122) | Get-Random -Count 32 | % {[char]$_})

# Delete the existing secret for the access key
kubectl delete secret sps-api-access-key --ignore-not-found

# Create the new secret
kubectl create secret generic sps-api-access-key --from-literal=restapiaccesskey=$newRestApiAccessKey
kubectl label secrets sps-api-access-key app.kubernetes.io/managed-by=Helm

# Restart the REST API server
kubectl rollout restart deployment sps-api

# Print the new access key value for confirmation
echo "The new REST API access key is: $newRestApiAccessKey"