I have a problem in task 4, 6 in challenge lab in Manage Kubernetes in Google Cloud

I followed the steps in tasks 4 , 6 but it doesn't check my progress 

in task 4 
I used this in my query

 resource.type="k8s_container"
severity=ERROR
labels."k8s-pod/app": "recommendationservice"

and create metric and policy but It didn't make sense 

 

in task 6 :

I updated the image in helloweb-deployment.yaml and used the following commands 

docker build -t us-central1-docker.pkg.dev/<YOUR_PROJECT_ID>/demo-repo/hello-app:v2 .

gcloud auth configure-docker us-central1-docker.pkg.dev

kubectl delete deployment helloweb --namespace=gmp-6er5

kubectl apply -f hello-app/manifests/helloweb-deployment.yaml --namespace=gmp-6er5

kubectl expose deployment helloweb --namespace=gmp-6er5 --name=helloweb-service-6h0c --type=LoadBalancer --port=8080 --target-port=8080

kubectl get svc helloweb-service-6h0c --namespace=gmp-6er5

 

1 3 577
3 REPLIES 3

 

Task 4: Creating Metric and Policy

  1. Query Syntax: Ensure your query syntax is correct. It should look like this:

    resource.type="k8s_container"
    severity=ERROR
    labels."k8s-pod/app"="recommendationservice"
  2. Metric Creation: After running the query, make sure you create the metric correctly. Verify that the metric is being recorded by checking the logs.

  3. Policy Configuration: Ensure that the alerting policy is set up correctly and is linked to the metric you created. Double-check the conditions and notification channels.

Task 6: Updating the Image and Deployment

  1. Docker Build: Ensure the Docker image is built and tagged correctly:

    docker build -t us-central1-docker.pkg.dev/<YOUR_PROJECT_ID>/demo-repo/hello-app:v2 .
  2. Docker Authentication: Make sure you have authenticated Docker with Google Cloud:

    gcloud auth configure-docker us-central1-docker.pkg.dev
  3. Deployment Update: Verify that the deployment is updated correctly:

    kubectl delete deployment helloweb --namespace=gmp-6er5
    kubectl apply -f hello-app/manifests/helloweb-deployment.yaml --namespace=gmp-6er5
  4. Service Exposure: Ensure the service is exposed correctly:

    kubectl expose deployment helloweb --namespace=gmp-6er5 --name=helloweb-service-6h0c --type=LoadBalancer --port=8080 --target-port=8080
  5. Service Verification: Check the service status:

    kubectl get svc helloweb-service-6h0c --namespace=gmp-6er5

Additional Tips

  • Logs and Errors: Check the logs for any errors or warnings that might indicate what went wrong. Use kubectl logs to view the logs of your pods.
  • Google Cloud Console: Sometimes, the Google Cloud Console might provide more insights into what might be missing or misconfigured.
  • Documentation and Support: Refer to the Google Cloud documentation for detailed steps and troubleshooting tips. If the issue persists, consider reaching out to Google Cloud support for assistance.

 

 

kc3
Silver 4
Silver 4

Hello,

regarding the metric, please try instructions below. For the deployment, are you perhaps missing the push of the image to artifact history if you are deploying from there?

---- metric example

1. Go to log base metric

2. Click Create Metric.

3. Use the following details to configure your metric:

Metric type: Counter
Log Metric Name : pod-image-errors

4. Enable Show query and in the Query builder box, add the following query:

resource.type="k8s_pod"
severity=WARNING

---- deployment

gcloud auth configure-docker $REGION-docker.pkg.dev --quiet
docker build -t $REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2 .
docker push $REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2
kubectl set image deployment/helloweb -n $NAMESPACE hello-app=$REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2
kubectl expose deployment helloweb -n $NAMESPACE --name=$SERVICE_NAME --type=LoadBalancer --port 8080 --target-port 8080

I tried those steps but it didn't make sense and I had only one chance

Top Labels in this Space