Home > Net >  GCP Kuberentes Cloud Deploy vs Cloud build
GCP Kuberentes Cloud Deploy vs Cloud build

Time:09-25

I am deploying a kubernetes app via github on GCP clusters. Everything works fine then.. I came across cloud deploy delivery pipeline..now I am stuck.

Following the docs here

apiVersion: skaffold/v2beta12
kind: Config
build:
  artifacts:
  - image: skaffold-example
deploy:
  kubectl:
    manifests:
      - k8s-*

In the k8s folder I have my deployment files like so

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ixh-auth-depl
  labels:
    app: ixh-auth
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ixh-auth
  template:
    metadata:
      labels:
        app: ixh-auth
    spec:
      containers:
      - name: ixh-auth
        image: mb/ixh-auth:latest
        ports:
        - containerPort: 3000
        resources:
          requests:
            cpu: 100m
            memory: 500Mi

but it gives the error invalid kubernetes manifest. I cannot find anything to read on this and don't know how to proceed.

CodePudding user response:

The correct way to declare the manifests was this. The wildcard probably didn't work. The folder name here would be k8s-manifests.

deploy:
  kubectl:
    manifests:
      - k8s-manifests/redis-deployment.yml
      - k8s-manifests/node-depl.yml
      - k8s-manifests/node-service.yml
  

CodePudding user response:

@Abhishek Rai, I agree with your answer. Google Cloud Deploy uses skaffold render to render your Kubernetes manifests, replacing untagged image names with the tagged image names of the container images you're deploying. Then when you promote the release, Google Cloud Deploy uses skaffold apply to apply the manifests and deploy the images to your Google Kubernetes Engine cluster.The content of manifest files should include the path of the yaml files as

deploy:
  kubectl:
    manifests:
      - PATH_TO_MANIFEST

so that the error will not be encountered. Refer to the document for more details.

  • Related