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
-
Hello,
When you say you created something similar, perhaps you have a white space issue, or other typo. In this particular case I am not aware of using a myapp.yaml file in Exercise 3.3. I assume you are trying to reproduce the simpleapp.yaml. Did you diff the two files to see how they are different?
Perhaps use a YAML checker to see where the whitespace issue may be. You can use this site json2yaml.com/ and edit the YAML to see what happens.
Regards,
0 -
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: simpleapp
andname: goproxy
start at column 9. With reference to thename
fields, 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: 6
0 -
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
- 217 LFX Mentorship
- 217 LFX Mentorship: Linux Kernel
- 788 Linux Foundation IT Professional Programs
- 352 Cloud Engineer IT Professional Program
- 177 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 146 Cloud Native Developer IT Professional Program
- 137 Express Training Courses
- 137 Express Courses - Discussion Forum
- 6.2K Training Courses
- 46 LFC110 Class Forum - Discontinued
- 70 LFC131 Class Forum
- 42 LFD102 Class Forum
- 226 LFD103 Class Forum
- 18 LFD110 Class Forum
- 37 LFD121 Class Forum
- 18 LFD133 Class Forum
- 7 LFD134 Class Forum
- 18 LFD137 Class Forum
- 71 LFD201 Class Forum
- 4 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 694 LFD259 Class Forum
- 111 LFD272 Class Forum
- 4 LFD272-JP クラス フォーラム
- 12 LFD273 Class Forum
- 147 LFS101 Class Forum
- 1 LFS111 Class Forum
- 3 LFS112 Class Forum
- 2 LFS116 Class Forum
- 4 LFS118 Class Forum
- 6 LFS142 Class Forum
- 5 LFS144 Class Forum
- 4 LFS145 Class Forum
- 2 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 2 LFS157 Class Forum
- 25 LFS158 Class Forum
- 7 LFS162 Class Forum
- 2 LFS166 Class Forum
- 4 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 31 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム
- 18 LFS203 Class Forum
- 130 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 52 LFS241 Class Forum
- 48 LFS242 Class Forum
- 38 LFS243 Class Forum
- 15 LFS244 Class Forum
- 2 LFS245 Class Forum
- LFS246 Class Forum
- 48 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 151 LFS253 Class Forum
- 1 LFS254 Class Forum
- 1 LFS255 Class Forum
- 7 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 118 LFS260 Class Forum
- 159 LFS261 Class Forum
- 42 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 22 LFS268 Class Forum
- 30 LFS269 Class Forum
- LFS270 Class Forum
- 202 LFS272 Class Forum
- 2 LFS272-JP クラス フォーラム
- 1 LFS274 Class Forum
- 4 LFS281 Class Forum
- 9 LFW111 Class Forum
- 259 LFW211 Class Forum
- 181 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 795 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 102 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 758 Linux Distributions
- 82 Debian
- 67 Fedora
- 17 Linux Mint
- 13 Mageia
- 23 openSUSE
- 148 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 353 Ubuntu
- 468 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 93 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 63 Mobile Computing
- 18 Android
- 33 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 22 Study Material
- 805 Programming and Development
- 303 Kernel Development
- 484 Software Development
- 1.8K Software
- 261 Applications
- 183 Command Line
- 3 Compiling/Installing
- 987 Games
- 317 Installation
- 96 All In Program
- 96 All In 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)