Error: mapping values are not allowed in this context

When I try to complete the necessary step to solve the problem, I get an error, which you can see in the screenshot. Here is the invitation and its description: "Kubernetes, level 1. Task 9 is to create a countdown task in Kubernetes. The Nautilus development team develops tasks in the Kubernetes cluster. While they are developing real scenarios/commands, they are currently setting up templates and testing tasks with dummy commands. Please create a task template according to the details below:

Create a task named countdown-datacenter.

The specification template should be called countdown-datacenter (in the metadata section), and the container should be called container-countdown-datacenter

Use the fedora image with the latest tag (be sure to specify it as fedora:latest) and set the restart policy to Never.

Run the sleep 5 command

Note: The kubectl utility on jump_host is configured to work with the Kubernetes cluster.

Here’s screenshot:


The problem is with the template key in the deployment. It can’t take a string value, so you can’t both have it take the value of a string and a map; these are mutually exclusive options.

    template: 
       spec:

is what you want.

1 Like

Alright, thank you for the answer.