Search code examples
google-cloud-platformgoogle-kubernetes-enginegithub-actions

Google Kubernetes Engine & Github actions deploy deployments.apps "gke-deployment" not found


I've been trying to run Google Kubernetes Engine deploy action for my github repo.

I have made a github workflow job run and everything works just fine except the deploy step.

Here is my error code:

Error from server (NotFound): deployments.apps "gke-deployment" not found

enter image description here

I'm assuming my yaml files are at fault, I'm fairly new to this so I got these from the internet and just edited a bit to fit my code, but I don't know the details.

Kustomize.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

metadata:
  name: arbitrary

# Example configuration for the webserver
# at https://github.com/monopole/hello
commonLabels:
  app: videoo-render

resources:
- deployment.yaml
- service.yaml

deployment.yaml (I think the error is here):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: the-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      deployment: video-render
  template:
    metadata:
      labels:
        deployment: video-render
    spec:
      containers:
      - name: the-container
        image: monopole/hello:1
        command: ["/video-render",
                  "--port=8080",
                  "--enableRiskyFeature=$(ENABLE_RISKY)"]
        ports:
        - containerPort: 8080
        env:
        - name: ALT_GREETING
          valueFrom:
            configMapKeyRef:
              name: the-map
              key: altGreeting
        - name: ENABLE_RISKY
          valueFrom:
            configMapKeyRef:
              name: the-map
              key: enableRisky

service.yaml:

kind: Service
apiVersion: v1
metadata:
  name: the-service
spec:
  selector:
    deployment: video-render
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 8666
    targetPort: 8080

Using ubuntu 20.04 image, repo is C++ code.


Solution

  • For anyone wondering why this happens:

    You have to edit this line to an existing deployment:

     DEPLOYMENT_NAME: gke-deployment # TODO: update to deployment name,
    

    to:

     DEPLOYMENT_NAME: existing-deployment-name