Search code examples
kubernetesgoogle-cloud-platformgoogle-kubernetes-enginegithub-actionsgke-networking

Google Cloud Kubernetes Engine "gke-deployment" not found while running github actions


I'm trying to deploy my code to GKE using github actions and when I run the action it says that service and deployment is created but then gives off an error, also the deployment it created in the cloud has an error.

enter image description here

And this is the deployment it creates:

enter image description here

My deployment.yaml file:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-1
  labels:
    type: nginx  # <-- correct
spec:
  selector:
    matchLabels:
      type: nginx  # incorrect, remove the '-'
  template:
    metadata:
      labels:
        type: nginx  # incorrect, remove the '-' 
    spec:
        containers:
        - image: nginx:1.14
          name: renderer
          ports:
           - containerPort: 80

My service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: nginx-3-service
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80

I just want to simply deploy my C++ code to kubernetes engine so I can experiment with it. I'm trying to push an ubuntu 20.04 image to europe-west1.

This question says that I must change the zone to fix the cloud's deployment's error but I'm not sure whether it will fix my problem or not and I don't know how to properly change it.


Solution

  • So appereantly, for anyone facing this issue, you have to change the name of your DEPLOYMENT_NAME variable name inside your google.yaml file to your deployments name so it is the same as metadata: name: "---" inside your deployment.yaml, in my case I changed my DEPLOYMENT_NAME into nginx-1 to fix the issue.