https://github.com/kameshsampath/ko-drone-k3d-demo
Rapid golang application deployment using ko, drone and kubernetes.
https://github.com/kameshsampath/ko-drone-k3d-demo
demo drone-ci k3d k3s ko-build kubernetes
Last synced: 3 months ago
JSON representation
Rapid golang application deployment using ko, drone and kubernetes.
- Host: GitHub
- URL: https://github.com/kameshsampath/ko-drone-k3d-demo
- Owner: kameshsampath
- License: apache-2.0
- Created: 2022-11-18T03:35:25.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-18T08:13:27.000Z (almost 3 years ago)
- Last Synced: 2024-12-22T20:03:05.926Z (10 months ago)
- Topics: demo, drone-ci, k3d, k3s, ko-build, kubernetes
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Using `ko` with `Drone CI` and `k3d`
An example to show how to use [ko](https://ko.build) as part of [Drone CI](https://drone.io) pipelines to deploy an application to [k3s](https://k3s.io) cluster on your laptop.
## Pre-requisites
- [Docker for Desktop](https://www.docker.com/products/docker-desktop/)
- [Drone CLI](https://docs.drone.io/cli/install/)
- [k3d](https://k3d.io)
- [ko](https://ko.build)## Run Pipeline
```shell
drone exec --trusted
```If all goes well you should have the `hello-world` deployment running in your cluster.
Validate the deployment
```shell
export KUBECONFIG="$PWD/.kube/config.external"
```Check the pods and services,
```shell
kubectl get pods,svc
``````shell
NAME READY STATUS RESTARTS AGE
pod/hello-world-566b6d7896-6qts9 1/1 Running 0 4m9sNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.43.0.1 443/TCP 13m
service/hello-world ClusterIP 10.43.224.48 8080/TCP 12m
```Do port forward the `hello-world` service,
```shell
kubectl port-forward deployments/hello-world 8080
```Calling the service,
```shell
curl localhost:8080/
```## Using `ko` from host
If you have installed `ko` locally, then run the command to deploy the application.
```shell
export KUBECONFIG="$PWD/.kube/config.external"
export KO_DOCKER_REPO="k3d-myregistry.localhost:5001/examples"
ko apply --insecure-registry -f config/
```## Clean up
```shell
drone exec --trusted pipeline=clean
```