Hello,
For the Kodekloud engineer practice test for the following question
Deploy Replica Set in Kubernetes Cluster
i am seeing an issue. Although my labels and app-name is same as what is asked in the question
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: httpd-replicaset
spec:
replicas: 4
selector:
matchLabels:
app: httpd_app
template:
metadata:
name: httpd
labels:
app: httpd_app
type: front-end
spec:
containers:
- name: httpd-container
image: httpd:latest
~
still when i submit its saying that the labels are not matching… Can u pls check this ASAP
Please when posting YAML manifests
use code blocks
All the formatting is lost in what you posted, and formatting is part of YAML spec - therefore we cannot verify what you have is correct.
Here is the replicaset.yaml file
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: httpd-replicaset
spec:
replicas: 4
selector:
matchLabels:
app: httpd_app
template:
metadata:
name: httpd-container
labels:
app: httpd_app
type: front-end
spec:
containers:
- name: httpd-container
image: httpd:latest
And the related task is this
1. Create a ReplicaSet using httpd
image with latest
tag (ensure to specify as httpd:latest
) and name it httpd-replicaset
.
2. Apply labels: app
as httpd_app
, type
as front-end
.
3. Name the container httpd-container
. Ensure the replica count is 4
.
Can u pls check once why is it saying that the label is not matching
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: nginx-replicaset
labels:
app: nginx_app
type: front-end
spec:
replicas: 4
selector:
matchLabels:
type: front-end
template:
metadata:
labels:
type: front-end
spec:
containers:
- name: nginx-container
image: nginx:latest
you have missed the metadata.label and selector.matchlabels entry in spec
i have pasted the above code for your reference