Giter VIP home page Giter VIP logo

devfest-23-demo's Introduction

Migration Seamless onto GKE from Cloud Run

Sample Go application: Migration Seamless onto GKE from Cloud Run

Prerequisites

  • Google Cloud Account
  • Payment enabled OR cloud credits
  • Idenity and Access Management (IAM) API should be enabled to run Cloud Run
  • Kubernetes Engine API should be enabled to run GKE
  • GKE or GKE Autopilot cluster

Steps to migrate the application

1. Export Cloud Run yaml file

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  annotations:
    run.googleapis.com/ingress: all
    run.googleapis.com/ingress-status: all
  labels:
    cloud.googleapis.com/location: us-central1
    commit-sha: 30add32cef487f1a5783d4b91d0886ba5730cd88
    gcb-build-id: 76dddc5b-8da5-400a-9454-62a8c7e765be
    gcb-trigger-id: 8f699efa-a34a-4818-9861-b8bfc6f49e4b
    gcb-trigger-region: global
    managed-by: gcp-cloud-build-deploy-cloud-run
  name: devfest-demo-test-1
  namespace: '875854415969'
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/maxScale: '100'
        run.googleapis.com/client-name: gcloud
        run.googleapis.com/client-version: 456.0.0
        run.googleapis.com/startup-cpu-boost: 'true'
      labels:
        client.knative.dev/nonce: bbtzrrkdxs
        commit-sha: 30add32cef487f1a5783d4b91d0886ba5730cd88
        gcb-build-id: 76dddc5b-8da5-400a-9454-62a8c7e765be
        gcb-trigger-id: 8f699efa-a34a-4818-9861-b8bfc6f49e4b
        gcb-trigger-region: global
        managed-by: gcp-cloud-build-deploy-cloud-run
        run.googleapis.com/startupProbeType: Default
    spec:
      containerConcurrency: 80
      containers:
      - image: us-central1-docker.pkg.dev/devfest-2023-407412/cloud-run-source-deploy/demo-go-app:30add32cef487f1a5783d4b91d0886ba5730cd88
        name: placeholder-1
        ports:
        - containerPort: 8080
          name: http1
        resources:
          limits:
            cpu: 1000m
            memory: 512Mi
        startupProbe:
          failureThreshold: 1
          periodSeconds: 240
          tcpSocket:
            port: 8080
          timeoutSeconds: 240
      serviceAccountName: [email protected]
      timeoutSeconds: 300
  traffic:
  - latestRevision: true
    percent: 100

2. Modify the YAML to match a Kubernetes deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: devfest-demo-test-1
  namespace: default
spec:
  template:
    metadata:
      labels:
        app: devfest-demo-test-1
    spec:
      containers:
      - image: busybox:latest
        name: placeholder-1
        ports:
        - containerPort: 8080
          name: http1
        resources:
          limits:
            cpu: 1000m
            memory: 512Mi
        startupProbe:
          failureThreshold: 1
          periodSeconds: 240
          tcpSocket:
            port: 8080
    replicas: 1
    selector:
      matchLabels:
        app: devfest-demo-test-1

3. Deploy the application to GKE

kubectl apply -f deployment.yaml

4. Expose the application to the internet

kubectl expose deployment devfest-demo-test-1 --type=LoadBalancer --port 80 --target-port 8080

5. Verify the application

kubectl get svc

devfest-23-demo's People

Contributors

chamodshehanka avatar kaveeshag avatar tsuresh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.