Git Product home page Git Product logo

k8s-alpha-deployments's Introduction

About Kubernetes Alpha Deployments

Using Helm with Ambassador, you can generate routes for alpha deployments that are routed to your own CNAME (ie: *.alpha)

Hence, developers can deploy their alpha build (app) to a k8s namespace (alpha) and then use this build to test their app before merging to the mainline repo.

On helm release deploy, this would generate a dynamic alpha URL which uses the Values app + commit hash to create the deployment publicly available host.

Example Alpha URL: http://api-e78587c397.alpha.domain.com

Installation & Deployment Steps:

  1. Instead Ambassador, like:
helm upgrade --install --wait my-ambassador stable/ambassador
  1. Extract the the Ambassador k8s service External IP:
kubectl get svc -o wide ambassador

expected output:

NAME        TYPE          CLUSTER-IP   EXTERNAL-IP   PORT(S)        AGE   SELECTOR
ambassador  LoadBalancer  10.x.x.x     35.x.x.x      80:31131/TCP   17m   service=ambassador
  1. Create the following DNS entry with the Ambassador External IP:
Type Name Value
CNAME *.alpha 35.x.x.x
  1. Modify the Values.yaml file with your repo's app name and the repo's latest commit:

Example Values.yaml required:

app: api
commit: e78587c397e259747e6bc52e39aff1c8887fb279
  1. On your CI/CD deployments (ie: Jenkins, etc) create a Helm release for your application:
helm upgrade --debug --install --wait alpha-app-1 ./alpha

Example template populated during release:

---
# Source: alpha/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  app: api
  name: api-e78587c397
  namespace: alpha
  alpha.deploy: true
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind: Mapping
      name: api-e78587c397
      host: api-e78587c397.alpha.domain.com
      prefix: /
      service: api-e78587c397.alpha:80
spec:
  selector:
    app: api-e78587c397
  ports:
  - protocol: TCP
    port: 80
---
# Source: alpha/templates/deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  app: api
  name: api-e78587c397
  namespace: alpha
  alpha.deploy: true
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: api-e78587c397
    spec:
      containers:
      - name: httpd
        image: "httpd"
        ports:
        - containerPort: 80

The above will output a message like the following with the alpha URL where the application has deployed:

Alpha URL: http://api-e78587c397.alpha.domain.com


Note: You can create a weekly cronjob to delete all alpha deployments after inactivity.

To delete the existing Helm release:

helm delete alpha-app-1

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.