Deploying to a Kubernetes cluster (initial deployment)

In this example, we will describe how to deploy to the Google Kubernetes Engine for simplicity.

By default, the Asyngular app is configured to be served over TLS/HTTPS/WSS so you will either need to disable TLS on the Ingress resource or you will need to provide the path to a private key and cert to use for TLS (the files need to be on your local machine; you may want to use a self-signed key and cert pair for simplicity).

If you want to save yourself the hassle of generating a TLS key and cert pair, it may be easier to simply disable TLS; to do this, you just need to edit myapp/kubernetes/agc-ingress.yaml and remove the tls section under spec and the annotations section under metadata .

To deploy your app to your Kubernetes cluster, you will first need to add your cluster config to your kubectl ~/.kube/config file. For GKE, you can just use this command (replace name-of-my-cluster with the name of your cluster as displayed in your GKE control panel):

gcloud container clusters get-credentials name-of-my-cluster

Now you can deploy using:

asyngular deploy

Just follow the prompts. The first deployment will prompt you for a lot of info. Once you’re done, a file called asyngular-k8s.json will be created in your project directory for convenience; this file will make subsequent deployments faster and easier. Do not commit this file to your repo though as it may contain encoded authentication details for your DockerHub account.

!! Note that for the initial deployment on GKE, it may take several minutes (sometimes 10 or more) for the ingress controller to launch. Once the ingress service warnings go away, you should be able to access your app over the public internet using the ingress IP address provided by GKE (e.g. https://xxx.xxx.xxx.xxx ). If using TLS, make sure that you use https:// at the start of the URL because the GKE ingress does not offer HTTP to HTTPS redirection by default.

!! Subsequent deployments using asyngular deploy-update should be much faster; often less than a minute.