Below is a description of each command. While you normally won't need exposure to the implementation details of each command, having a working knowledge of Kubernetes will be beneficial in understanding their behavior.
List all aliases (hostnames that map to deployments).
Configures your Kubernetes cluster so hostname alias
points to a deployment named deployment
.
Remove host name alias
from any deployment in may point to, and any associated SSL configuration for alias
. If you continue to have a DNS A record for alias
that points to your Kubernetes cluster, all responses for hostname alias
will be served with the default certificate.
Lists all certificates.
Creates a certificate with the first common name (cn
) listed. The first and all subsequent cn
are listed in the certificate's Subject Alternative Names (SANs) section.
This allows you to create a single certificate for multiple domain names.
Delete a Kubernetes certificate
object with id cn
. Does not delete the Kubernetes secret
holding the certificate/private key pair.
Creates a Kubernetes cluster to host your deployments.
- You are authenticated to the cloud provider of your choosing.
- A Kubernetes cluster is created.
- tiller is installed, which is used to install:
- cert-manager
- Will automatically watch your deployments and request new certificates for hostnames.
- Request new certificates when they're closing to expiring and seamlessly update in production.
- ingress-nginx
- Installing ingress-nginx will instantiate a load balancer, e.g., on GCP this instantiate a TCP Proxy Load Balancer.
- The nginx controller is a Kubernetes object of type
service
. - The type of service is
LoadBalancer
. - Used for mapping hostnames to deployments.
- All HTTP traffic is permanently redirected (HTTP 308) to HTTPS.
- SSL termination occurs prior to requests reaching deployments.
- cert-manager
Also aliased as snow
. Your current directory must have both Dockerfile
and now.json
files. Example now.json
:
{
"name": "myapp", // required
"alias": ["api.myapp.com", "myapp.com"],
"files": ["server.js"]
}
The deployment process:
- The files listed in
now.json
plusDockerfile
(collectively referred to as the "build context") are assembled into a tar archive. - Kaniko creates a Docker image from the build context, and pushes it to the private Docker registry in your Kubernetes cluster.
- A Kubernetes
deployment
resource is created for your image. - A Kubernetes
service
resource exposes your deployment. - A Kubernetes
ingress
resource maps hostnames (listed asalias
array in now.json) to the service. - cert-manager continually inspects ingresses, so if a deployment needs SSL certificates, they will be generated upon deployment.
For your domain name to be resolvable by Kubernetes, you must:
- create a DNS
A
record, which points to the IP Address of your load balancer (which can be found viasnow ip
). - Alias the domain name to a deployment.
List all configured domain names.
Verifies DNS records are configure properly for domain
. Creates rule to redirect traffic from domain
to the default backend. Requests an SSL certificate from Let's Encrypt, if one is not present in the cluster, and sets up SSL termination.
Removes any traffic redirect rules from domain
. Removes SSL termination with the Let's Encrypt SSL certificate for domain
(the default certificate will be used instead).
The Let's Encrypt SSL certificate will remain persisted (which is helpful if the domain is added later, and it avoids an unnecessary request for a new certificate: requests are limited by Let's Encrypt rate limits). Traffic from domain
will redirect to the default backend.
Install dependencies using brew
.
Prints the IP address of your cluster's load balancer. You'll need this for configuring DNS A
records that point to your load balancer.
Asks which cloud provider you are using, and configures your kube config file (typically at ~/.kube/config
). Since you will need credentials to your Kubernetes cluster to perform operations on it, you must login (or have a properly configured kube file) prior to running snow commands.
Remove all credentials from your kube config file (typically at ~/.kube/config
).
List all deployments.
Deplete deployment name
.
Configure a deployment named deployment
to scale to a min
/ max
number of instances. If no max
is specified, the min
is used as the max
.
List all secrets. This will only show secrets created by the snow API, which are annotated in Kubernetes with label snowsecret=true
.
Create a secret named key
.
Rename a secret from old-key
to new-key
. In Kubernetes, this means removing the old key, and creating a new key with identical info.
Delete a secret with name key
.