Yaml file issue in CKAD lab 3.3
Hello All,
Can anyone let me know if someone reached past the Lab Exercise 3.3. I am having having an issue with the YAML file. I have created file similar to what is mentioned in the course but while while using kubectl create -f myapp.yaml it gives below error
"error: error parsing myapp.yaml: error converting YAML to JSON: yaml: line 44: did not find expected key.
This may be very well a small thing to get sorted out but excuse my little experience with kubernetes as i am totally new to kubernetes. Any help would be much appreciate.
Thank You,
Answers
-
Hi Serewicz,
Yes that's simpleapp I am referring to. I just had changed the name of the app and did check in https://codebeautify.org/yaml-validator showed me some whitespace, even after changing it i was not able to get that app working. I will check in json2yaml.com now and see.
0 -
I did check the same code in json2yaml.com and It gave me below error "x Did not find expected key while parsing a block mapping at line 27 column 5". I had never touched line 27
0 -
I checked in Microsoft vs code it gives me below errors only for one line and which is
- name: goproxythe errors are
{
"resource": "/D:/studies/ckad/yousufapp.yaml",
"owner": "generated_diagnostic_collection_name#2",
"severity": 8,
"message": "A block sequence may not be used as an implicit map key",
"source": "YAML",
"startLineNumber": 45,
"startColumn": 1,
"endLineNumber": 45,
"endColumn": 21
}{
"resource": "/D:/studies/ckad/yousufapp.yaml",
"owner": "generated_diagnostic_collection_name#2",
"severity": 8,
"message": "Implicit keys need to be on a single line",
"source": "YAML",
"startLineNumber": 45,
"startColumn": 5,
"endLineNumber": 45,
"endColumn": 21
}{
"resource": "/D:/studies/ckad/yousufapp.yaml",
"owner": "generated_diagnostic_collection_name#2",
"severity": 8,
"message": "Implicit map keys need to be followed by map values",
"source": "YAML",
"startLineNumber": 45,
"startColumn": 5,
"endLineNumber": 45,
"endColumn": 21
}0 -
Hi @myousufm,
The YAML files for the simpleapp deployment provided in the SOLUTIONS tarball can be used as templates for other application deployments. Both containers defined follow the same indentation rules, with identical properties equally indented:
name: simpleappandname: goproxystart at column 9. With reference to thenamefields, other fields will be indented to the right +2, +4, or more spaces, or to the left -2, -4, or more spaces.Regards,
-Chris0 -
Hi @chrispokorni ,
Thanks for your help here. I didnt get by +2, +4 and -2, -4 spaces. Sorry but I am new to yaml and didnt quiet get that. I have pasted below the code which i have that will give more clear pic of what may have gone wrong in the code. I am sure it would something small which i fail to understand at the moment.
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2021-10-19T07:46:03Z"
generation: 2
labels:
app: try1
name: try1
namespace: default
resourceVersion: "7961"
uid: c23f5399-e3b1-449a-be9e-ffd546905ab7
spec:
progressDeadlineSeconds: 600
replicas: 6
revisionHistoryLimit: 10
selector:
matchLabels:
app: try1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: try1
spec:
containers:
- image: 10.103.26.66:5000/yousufapp
imagePullPolicy: Always
name: yousufapp
readinessProbe:
periodSeconds: 5
exec:
command:
- cat
- /tmp/healthy
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
- name: goproxy
image: k8s.gcr.io/goproxy:0.1
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 6
conditions:
- lastTransitionTime: "2021-10-19T07:46:39Z"
lastUpdateTime: "2021-10-19T07:46:39Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2021-10-19T07:46:03Z"
lastUpdateTime: "2021-10-19T07:46:39Z"
message: ReplicaSet "try1-66cb6c68c5" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 2
readyReplicas: 6
replicas: 6
updatedReplicas: 60 -
Hi @myousufm,
Please use the Code formatting tags when pasting YAML to preserve your code's indentation.
Regards,
-Chris0 -
apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "1" creationTimestamp: "2021-10-19T07:46:03Z" generation: 2 labels: app: try1 name: try1 namespace: default resourceVersion: "7961" selfLink: /apis/apps/v1/namespaces/default/deployments/try1 uid: c23f5399-e3b1-449a-be9e-ffd546905ab7 spec: progressDeadlineSeconds: 600 replicas: 6 revisionHistoryLimit: 10 selector: matchLabels: app: try1 strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: creationTimestamp: null labels: app: try1 spec: containers: - image: 10.103.26.66:5000/yousufapp #<<-- EDIT for your registry IP imagePullPolicy: Always name: simpleapp readinessProbe: periodSeconds: 5 exec: command: - cat - /tmp/healthy resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File - name: goproxy image: k8s.gcr.io/goproxy:0.1 ports: - containerPort: 8080 readinessProbe: tcpSocket: port: 8080 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: tcpSocket: port: 8080 initialDelaySeconds: 15 periodSeconds: 20 dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 status: availableReplicas: 6 conditions: - lastTransitionTime: "2021-10-19T07:46:39Z" lastUpdateTime: "2021-10-19T07:46:39Z" message: Deployment has minimum availability. reason: MinimumReplicasAvailable status: "True" type: Available - lastTransitionTime: "2021-10-19T07:46:03Z" lastUpdateTime: "2021-10-19T07:46:39Z" message: ReplicaSet "try1-66cb6c68c5" has successfully progressed. reason: NewReplicaSetAvailable status: "True" type: Progressing observedGeneration: 2 readyReplicas: 6 replicas: 6 updatedReplicas: 60 -
This code worked, I did compare to the ones in the tarball of the labs and corrected a few indentations. But still have visual code giving me error on "creationTimestamp: null". not sure why that error but it works when i create using this file.
0 -
Hi @myousufm,
I was hoping that the Code tags would format your YAML code as seen below, to help us troubleshoot your indentation:
apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "1" creationTimestamp: "2021-10-20T11:06:12Z" generation: 1 labels: app: try1 name: try1 namespace: default ...Do you see any issues in 3.2.19 when running the deployment from the YAML file generated in step 3.2.18?
Regards,
-Chris0 -
Hi Chris,
I tried to add code tags but it didnt pasted as yours. Haven't got any issues in the previous steps in the lab its only on exercise 3.3 after adding the readiness probe and liveleness probe i got error. But worked a way around by checking the indentations in the simpleapp.yaml file provided in the tarball of the course material.
Also if you have any suggestions on structure of the yaml file would help me in avoiding any further similar issues.
Many thanks
0 -
Thanks
0 -
Thank You
0
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 754 Linux Foundation IT Professional Programs
- 374 Cloud Engineer IT Professional Program
- 170 Advanced Cloud Engineer IT Professional Program
- 74 DevOps IT Professional Program - Discontinued
- 5 DevOps & GitOps IT Professional Program
- 100 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 2 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 5 Cloud & Containers Training
- 1 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 1 Networking Training
- 2 Open Source Best Practice Training
- 2 System Administration Training
- 1 System Engineering Training
- 1 Web & Application Development Training
- 794 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 89 Storage
- 769 Linux Distributions
- 81 Debian
- 68 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 112 Mobile Computing
- 20 Android
- 77 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 393 Off Topic
- 121 Introductions
- 182 Small Talk
- 29 Study Material
- 977 Programming and Development
- 310 Kernel Development
- 649 Software Development
- 990 Software
- 382 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)