Learn KOP - Troubleshooting Workloads - Rafay Product Documentation

Scenario 2: Incorrect Container Image

In this scenario, we will try to deploy a workload with a "misconfigured container image name". Once deployed, the underlying Kubernetes cluster will not able to find/pull this container image and will result in the infamous ImagePullBackOff error message. We will use the integrated troubleshooting capabilities to debug and diagnose the issue and resolve the issue.

YAML File

Save the following YAML to a file. Notice the typo in the image name.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
  annotations:
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latestt
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: "100m"
            memory: "30Mi"
          requests:
            cpu: "1000m"
            memory: "30Mi"

Create Workload

Publish Workload

The controller will send the specified YAML to the Kubernetes Operator on the remote cluster. The Kubernetes operator will then provide the manifest to the Kubernetes API server which will attempt to deploy it to the specified namespace. Once the Kubernetes operator receives an error message from the Kubernetes API server, it will propagate the error message back to the controller.

You will notice that the controller will retry publishing the workload a few times and will eventually fail.

Troubleshooting

Let us now use the integrated troubleshooting facilities in the platform to debug and diagnose the misconfigured workload.

This will take you to an Integrated Kubernetes Resources Dashboard

This will retrieve the list of "Kubernetes Events" in real time. In our example, we should see several error messages relating to the the ability to pull the container image. If we look closely at the error messages, we can see there is a typo in the image name.

We can now go back and edit the workload again to correct the typo in the image name.

image: nginx:latestt

The updated configuration is below:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
  annotations:
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: "100m"
            memory: "30Mi"
          requests:
            cpu: "100m"
            memory: "30Mi"

The workload will publish successfully within a few seconds.

Now that the workload has published, we will use the web console to validate the application status.

You will see that the workload is in a running state and everything is healthy.