Ketch is an application delivery framework that facilitates the deployment and management of applications on Kubernetes using a simple command line interface.
- Install the ketch CLI (official docs)
- The target Kubernetes cluster must include cert-manager and an ingress controller (Istio or Traefik)(official docs)
- Install the ketch controller
A script to prepare a fresh, generic cluster with these requirements is provided in setup-cluster.sh.
Ketch delivers an app by associating it with a framework and a buildpack builder. The framework describes the target environment where the app will be deployed; the buildpack builder determines how source is built into a runnable image.
Ketch relies on frameworks to define deployment configuration for a set of
apps. Add a framework with the following command, replacing
--ingress-service-endpoint
with the external address of a LoadBalancer if
available.
ketch framework add framework1 \
--namespace podtato-ketch \
--app-quota-limit '-1' \
--cluster-issuer selfsigned-cluster-issuer \
--ingress-class-name istio \
--ingress-type istio \
--ingress-service-endpoint '192.168.1.201'
Ketch can build and deploy an app from source using cloud-native buildpacks or can deploy a pre-built container image.
- Include a Procfile in the source directory. It may be empty.
- Create a secret for the registry where the built image will be pushed to after
build and pulled from for deploy (official
docs).
Reference that secret in the
ketch
command as parameter--registry-secret
. - Clone this repo and run the following command, replacing registry-secret and image repo hostname as appropriate:
ketch app deploy podtato-head ${root_dir}/podtato-services/main \
--registry-secret quay \
--builder paketobuildpacks/builder:full \
--framework framework1 \
--image quay.io/joshgav/podtato-main:latest
Deploy an app image without build with the following command:
ketch app deploy podtato-head-image \
--image quay.io/joshgav/podtato-main:latest \
--framework framework1
List all apps, get info or get logs for an app:
ketch app list
ketch app info podtato-head
ketch app log podtato-head
Browse to the address returned by the previous commands ending in shipa.cloud
to open your app.
NOTE: The address returned for the app can be directly opened if the istio-ingressgateway service is available via a service of type LoadBalancer. If the ingress gateway is exposed as a NodePort that port will have to be appended to the hostname. Get the port with the following command:
kubectl get services -n istio-system istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}'
Additional acceptable host names can be added to the application with the command that follows. You must configure DNS for the new name yourself.
ketch cname add myapp.example.com --app podtato-head
Run ketch app deploy
again. Specify --steps
and --step-interval
parameters to deploy gradually (canary style).
Run the following commands to remove the app and ketch controller from your cluster.
ketch app remove podtato-head
ketch app remove podtato-head-image
ketch framework remove framework1
ketch_version=0.4.0
kubectl delete -f https://github.com/shipa-corp/ketch/releases/download/v${ketch_version}/ketch-controller.yaml