Part 1: Troubleshoot
This is Part 1 of the exercise that will focus on troubleshooting a failed workload publish event. You will use the web console to deploy and troubleshoot.
What Will You Do¶
In part 1, you will:
- Create a namespace for the workload
- Publish and Troubleshoot a workload
Step 1: Create Namespace¶
In this step, we will create a namespace through the UI.
- Navigate to the project in your Org where the cluster is located
- Select Infrastructure -> Namespaces
- Click "New Namespace"
- Enter a Name for the namespace
- Select "Wizard" for the Type
- Click "Save"
- Click "Save & Go To Placement"
- Select the cluster to create the namespace on
- Click "Save & Go To Publish"
- Click "Publish"
The namespace is now published on the cluster.
- Click "Exit"
Step 2: Create Workload¶
In this step, we will create a YAML based workload and attempt to publish the workload to the cluster.
- Navigate to the project in your Org where the cluster is located.
- Select Applications -> Workloads
- Click New Workload -> Create New Workload
- Enter a Name for the Workload
- Select "k8s YAML" for the Package Type
- Select "Upload files manually"
- Select the namespace that was previously created
- Click "Continue"
- Save the following YAML to a file
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"
- Click "Choose File" to select the saved YAML file
- Click "Save and Go To Placement"
- Select the cluster where the namespace was created
- Click "Save and Go To Publish"
- Click "Publish"
After a few seconds, an error will be displayed. The error message will be similar to the following:
"cluster workload-gs: unable to upgrade: manifest create: Deployment.apps "nginx" is invalid: spec.template.spec.containers[0].resources.requests: Invalid value: "1": must be less than or equal to cpu limit"
This message indicates that the application resource requests are larger than the resource limits defined. We can now go back to the workload and edit the specification file to correct this problem.
- Click "Unpublish"
- Click "Yes" to confirm unpublishing the workload
- Click the "Upload" tab near the top of the screen
- Click "Edit"
- Update the CPU Requests to be less than or equal to the CPU Limit.
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:latestt
ports:
- containerPort: 80
resources:
limits:
cpu: "100m"
memory: "30Mi"
requests:
cpu: "100m"
memory: "30Mi"
- Click Update
- Click "Save and Go To Placement"
- Click "Save and Go To Publish"
- Click "Publish"
You will notice that the workload continues to try to be published and will eventually fail.
- Click "Debug"
You will see a list of events related to the workload. We can see there are several error messages relating to the the ability to pull the pod 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.
- Near the top of the page, click the workload name to go back to the workload
- Click "Edit" to edit the workload YAML
- Remove the extra "t" from the image value
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"
- Click "Update"
- Click "Save and Go To Placement"
- Click "Save and Go To Publish"
- Click "Publish"
The workload publishes within a few seconds.
Now that the workload has published, we will use the web console to validate the application status.
- Click "Debug"
- Click "Pods" on the left side of the window
You will see that the workload is in a running state.
Alternatively, you can open a Zero Trust KubeCTL channel at the top of the screen to verify pod status.
To go one step further, we can use the web console to access the logs of the workload to see what the applicaiton is doing.
- Click the Actions button of the pod
- Select "Shell and Logs" -> "Logs"
The application logs are presented in the window.
Recap¶
Congratulations! You have successfully deployed a workload and used the web console to troubleshoot and resolve issues with the workload.