An example to show how to use ko as part of Drone CI pipelines to deploy an application to k3s cluster on your laptop.
drone exec --trusted
If all goes well you should have the hello-world
deployment running in your cluster.
Validate the deployment
export KUBECONFIG="$PWD/.kube/config.external"
Check the pods and services,
kubectl get pods,svc
NAME READY STATUS RESTARTS AGE
pod/hello-world-566b6d7896-6qts9 1/1 Running 0 4m9s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 13m
service/hello-world ClusterIP 10.43.224.48 <none> 8080/TCP 12m
Do port forward the hello-world
service,
kubectl port-forward deployments/hello-world 8080
Calling the service,
curl localhost:8080/
If you have installed ko
locally, then run the command to deploy the application.
export KUBECONFIG="$PWD/.kube/config.external"
export KO_DOCKER_REPO="k3d-myregistry.localhost:5001/examples"
ko apply --insecure-registry -f config/
drone exec --trusted pipeline=clean