Hi! Your guidance is greatly appreciated. I’m running minikube version: v1.22.0 . . .

Victor Pacheco:
Hi! Your guidance is greatly appreciated.
I’m running minikube version: v1.22.0 on macOS.

After creating the POD (yaml file below), It installs fine. After creating the service: kubectl create -f voting-app-service.yaml
I get the following error:

“error: error validating “voting-app-service.yaml”: error validating data: ValidationError(Service.metadata): unknown field “app” in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false”

Below are the yaml files used. Any idea what’s going on?

voting-app-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: voting-app-pod
labels:
name: voting-app-pod
app: demo-voting-app
spec:
containers:

  • name: voting-app
    image: kodekloud/examplevotingapp_vote:v1
    ports:
    • containerPort: 80

voting-app-service.yaml
apiVersion: v1
kind: Service
metadata:
name: voting-service
labels:
name: voting-service
app: demo-voting-app
spec:
type: NodePort
ports:

  • port: 80
    targetPort: 80
    nodePort: 30004
    selector:
    name: voting-app-pod
    app: demo-voting-app

Tej_Singh_Rana:
voting-app-pod.yaml

apiVersion: v1
kind: Pod
metadata:
 name: voting-app-pod
 labels:
  name: voting-app-pod
  app: demo-voting-app
spec:
 containers:
  - name: voting-app
    image: kodekloud/examplevotingapp_vote:v1
    ports:
    - containerPort: 80

voting-app-service.yaml

apiVersion: v1
kind: Service
metadata:
 name: voting-service
 labels:
   name: voting-service
   app: demo-voting-app
spec:
 type: NodePort
 ports:
  - port: 80
    targetPort: 80
    nodePort: 30004
 selector:
  name: voting-app-pod
  app: demo-voting-app

Tej_Singh_Rana:
I formatted correctly. So above YAMLs will work.

Tej_Singh_Rana:
Space required under the service.metadata.labels

Victor Pacheco:
I see it… thank you so much!

Victor Pacheco:
Hi Tej. Any idea why my result-app-deployment pod wont go ready (sits there with (ContainerCreating)? This is what I see: Admins-MacBook-Pro:Voting-App admin$ kubectl describe pod result-app-deploy
Name: result-app-deploy-6cb79db456-8zxg6
Namespace: default
Priority: 0
Node: minikube/172.16.35.130
Start Time: Wed, 01 Sep 2021 14:20:06 -0700
Labels: app=demo-voting-app
name=result-app-pod
pod-template-hash=6cb79db456
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: ReplicaSet/result-app-deploy-6cb79db456
Containers:
result-app:
Container ID:
Image: kodekloud/examplevotingapp_result:v1
Image ID:
Port: 80/TCP
Host Port: 0/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5qbjz (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-5qbjz:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message


Normal Scheduled 5m44s default-scheduler Successfully assigned default/result-app-deploy-6cb79db456-8zxg6 to minikube
Normal Pulling 5m44s kubelet Pulling image “kodekloud/examplevotingapp_result:v1”

Admins-MacBook-Pro:Voting-App admin$
Admins-MacBook-Pro:Voting-App admin$
Admins-MacBook-Pro:Voting-App admin$ clear

Admins-MacBook-Pro:Voting-App admin$ kubectl get pods
NAME READY STATUS RESTARTS AGE
postgres-deploy-6f787b796b-n6hpk 1/1 Running 0 56m
redis-deploy-5d7988b4bb-6wxx4 1/1 Running 0 56m
result-app-deploy-6cb79db456-8zxg6 0/1 ContainerCreating 0 7m38s
voting-app-deploy-547678ccc7-wd6hj 1/1 Running 0 80m
worker-app-deploy-799b5fb489-t2kfq 1/1 Running 0 12m
Admins-MacBook-Pro:Voting-App admin$ kubectl describe pod result-app-deploy
Name: result-app-deploy-6cb79db456-8zxg6
Namespace: default
Priority: 0
Node: minikube/172.16.35.130
Start Time: Wed, 01 Sep 2021 14:20:06 -0700
Labels: app=demo-voting-app
name=result-app-pod
pod-template-hash=6cb79db456
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: ReplicaSet/result-app-deploy-6cb79db456
Containers:
result-app:
Container ID:
Image: kodekloud/examplevotingapp_result:v1
Image ID:
Port: 80/TCP
Host Port: 0/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5qbjz (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-5qbjz:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message


Normal Scheduled 11m default-scheduler Successfully assigned default/result-app-deploy-6cb79db456-8zxg6 to minikube
Normal Pulling 11m kubelet Pulling image “kodekloud/examplevotingapp_result:v1”

Admins-MacBook-Pro:Voting-App admin$

Victor Pacheco:
Please disregard. its finally running now. it just took a while. strange: NAME READY STATUS RESTARTS AGE
postgres-deploy-6f787b796b-n6hpk 1/1 Running 0 62m
redis-deploy-5d7988b4bb-6wxx4 1/1 Running 0 62m
result-app-deploy-6cb79db456-8zxg6 1/1 Running 0 14m
voting-app-deploy-547678ccc7-wd6hj 1/1 Running 0 86m
worker-app-deploy-799b5fb489-t2kfq 1/1 Running 0 18m
Admins-MacBook-Pro:Voting-App admin$