We’ve created an application - how do we get it into our Kubernetes cluster?
Developers often like to use command line tools to deploy applications. We’ll build a command line tool locally.
Our first step is to clone the Git repository containing the app locally.
git clone https://github.com/jaxxstorm/ploy.git
Change into this directory now ready to build our application:
cd ploy
This repo contains Pulumi code which uses the Automation API. A lot of the code is used to build a CLI application using popular the Go package Cobra
However, if you examine the code in pkg/program/program.go
you’ll notice a Go function NewPloyDeployment
.
This is a Pulumi component which encapulates a set of Pulumi resources.
In order to deploy our application to our Kubernetes cluster, we’ll need:
All of this is done via the command line tool.
We could also write a Pulumi program that uses the same logic, but this CLI tool can be used with no underlying knowledge of Pulumi.
It might be the case that you’re unable to build the binary on the Cloud9 instance. If you’re struggling to build it, you can download a pre-built binary from here: https://github.com/jaxxstorm/ploy/releases/download/v0.0.2-alpha/ploy-v0.0.2-alpha-linux-amd64.tar.gz
We’ll need to build the binary so we can use it. You can do this using the go build
command:
go build -o ploy ./cmd/ploy/main.go
The EC2 Cloud9 instance comes with several Docker Images on it that might mean you run out of space. If this happens, clear out these images - you won’t need them:
docker rmi $(docker images -q)
You should be able to run the ploy
command now locally:
./ploy
Deploy your applications
Usage:
ploy [command]
Available Commands:
destroy Remove your application
get Get all ploy deployed applications
help Help about any command
up Deploy your application
Flags:
--debug Enable debug logging
-h, --help help for ploy
-o, --org string Pulumi org to use for your stack
-r, --region string AWS Region to use (default "us-west-2")
Use "ploy [command] --help" for more information about a command.