{"id":16878755,"url":"https://github.com/peterj/kapp","last_synced_at":"2025-03-22T07:32:08.652Z","repository":{"id":57541129,"uuid":"131047964","full_name":"peterj/kapp","owner":"peterj","description":"Create Go app running in Kubernetes with minimal configuration","archived":false,"fork":false,"pushed_at":"2019-12-12T04:53:04.000Z","size":1353,"stargazers_count":34,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T09:22:10.881Z","etag":null,"topics":["cli","development-workflow","go","golang","hacktoberfest","helm","kubernetes"],"latest_commit_sha":null,"homepage":"https://peterj.github.io/kapp/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T18:29:48.000Z","updated_at":"2023-06-22T09:09:47.000Z","dependencies_parsed_at":"2022-09-15T01:43:19.797Z","dependency_job_id":null,"html_url":"https://github.com/peterj/kapp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fkapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fkapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fkapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fkapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterj","download_url":"https://codeload.github.com/peterj/kapp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244925175,"owners_count":20532873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","development-workflow","go","golang","hacktoberfest","helm","kubernetes"],"created_at":"2024-10-13T15:51:14.036Z","updated_at":"2025-03-22T07:32:08.205Z","avatar_url":"https://github.com/peterj.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Create *K*ubernetes _app_ (`kapp`)](https://peterj.github.io/kapp/)\n\n[![Build Status](https://travis-ci.org/peterj/kapp.svg?branch=master)](https://travis-ci.org/peterj/kapp)\n[![GitHub release](https://img.shields.io/github/release/peterj/kapp/all.svg)](https://github.com/peterj/kapp/releases)\n[![codecov](https://codecov.io/gh/peterj/kapp/branch/master/graph/badge.svg)](https://codecov.io/gh/peterj/kapp)\n\nCreate Go apps/services that run on Kubernetes with minimal configuration.\nInspiration for this project came from\n[create-react-app](https://github.com/facebook/create-react-app) project.\n\n*   [Quick Overview](#quick-overview)\n*   [Prerequisites](#prerequisites)\n*   [Installation](#installation)\n*   [Creating an App](#creating-an-app) - How to create a new Kubernetes app\n*   [Development Workflow](#development-workflow)\n\nTool was developed and tested on macOS. There's no guarantee that it works on\nother platforms. If you run into any issues, please\n[file them](https://github.com/peterj/kapp/issues/new).\n\n\u003e **Note**: At the moment, project only supports Go. Please\n\u003e [file an issue](https://github.com/peterj/kapp/issues/new) if you'd like to\n\u003e see support for other languages and/or [send a PR](CONTRIBUTING).\n\n# Quick Overview\n\n```bash\n# Creates an app called helloworld\nkapp create helloworld --package github.com/peterj/helloworld\n\n# Initialize the Git repo and make an inital commit\ncd helloworld\ngit init \u0026\u0026 git add * \u0026\u0026 git commit -m 'inital commit'\n\n# Build the app\nmake all\n```\n\nRun the app with `./helloworld` and access it at http://localhost:8080/.\n\n![kapp demo GIT](img/kapp-create.gif)\n\n# Prerequisites\n\n*   [Go](https://golang.org/dl/)\n*   [Docker](https://www.docker.com/docker-mac)\n*   [Helm](https://helm.sh/)\n*   [Dep](https://github.com/golang/dep)\n*   [Git](https://git-scm.com/)\n*   Kubernetes cluster - you can also use Kubernetes support in\n    [Docker for Mac](https://www.docker.com/docker-mac),\n    [Minikube](https://github.com/kubernetes/minikube) or an actual cluster from\n    one of the cloud providers\n\n# Installation\n\nYou can download the latest binary from the\n[Releases page](https://github.com/peterj/kapp/releases). Alternatively, you can\nuse `go get` and install `kapp` like that:\n\n```bash\ngo get github.com/peterj/kapp\nmake install\n```\n\nAlternatively, you can install kapp using `homebrew` on a mac.\n``` bash\nbrew install peterj/kapp/kapp\n```\n\n# Creating an app\n\nTo create a new Kubernetes app, run the following command:\n\n```\nkapp create helloworld --package github.com/[username]/helloworld\n```\n\n_Note: the package name is required in order to properly configure the generated\nfiles._\n\nThe command above will create a folder called `helloworld` in the current\nworking folder. The structure of the created Go project looks like this:\n\n```\nhelloworld\n├── Dockerfile\n├── Makefile\n├── VERSION.txt\n├── docker.mk\n├── go.mod\n├── go.sum\n├── helm\n│   └── helloworld\n│       ├── Chart.yaml\n│       ├── templates\n│       │   ├── _helpers.tpl\n│       │   ├── deployment.yaml\n│       │   ├── service.yaml\n│       │   ├── serviceaccount.yaml\n│       │   └── tests\n│       │       └── test-connection.yaml\n│       └── values.yaml\n├── main.go\n└── version\n    └── version.go\n```\n\n# Development workflow\n\nThe inital workflow for getting your app running in Kubernetes involves these\nsteps:\n\n1.  [Build the app image](#build-the-image)\n2.  [Push the app image to the registry](#push-the-image)\n3.  [Create intial app release (first deployment)](#first-deployment)\n4.  [Interact with the app](#interact-with-the-app)\n5.  [Deploy app updates](#deploy-app-upgrades)\n\nAfter you have created the inital release (step #3) you can continue with this\n[workflow](#deploy-app-upgrades)\n\n## Build the image\n\nMakefile task `build.image` can be used to build the Docker image that contains\nyour app and tag that image. Note that before you run `make build.image`, you\nhave to do these two things:\n\n1.  Login to the image registry you want to use\n2.  Set the `DOCKER_REGISTRY` environment variable to that registry\n\nBelow is an example on how to set the image registry and run the `build.image`\ntask:\n\n```bash\n$ cd helloworld\n\n# Login to the hub.docker.com (or any other image registry)\n$ docker login\n\n# Replace 'kubeapp' with your hub.docker.com username\n$ export DOCKER_REGISTRY=kubeapp\n\n# Build the image in format: kubeapp/helloworld:0.1.0\n$ make build.image\n-\u003e build.image\ndocker build -f  Dockerfile -t  kubeapp/helloworld:0.1.0 .\n... (Docker build output) ...\nSuccessfully tagged kubeapp/helloworld:0.1.0\n```\n\n## Push the image\n\nWith image built, you can use `make push.image` task to push the built image to\nthe registry:\n\n```bash\n$ make push.image\n-\u003e push.image\ndocker push  kubeapp/helloworld:0.1.0\nThe push refers to repository [docker.io/kubeapp/helloworld]\n... (docker push output)\n0.1.0: digest: sha256:b13772ff86c9f2691bfd56a6cbdc73d3456886f8b85385a43699706f0471c866 size: 1156\n```\n\n## First deployment\n\nTask `install.app` is used to create an inital installation/deployment of your\napp to Kubernetes. Before running this task, you need to ensure you have Helm\ninstalled and initialized on the cluster and your current cluster context is set\nto the cluster you want to deploy the app to.\n\n```bash\n$ make install.app\n-\u003e install.app\nkubectl create ns helloworld\nnamespace/helloworld created\nhelm install helloworld helm/helloworld --namespace helloworld --set=image.repository=pj3677/helloworld\nNAME: helloworld\nLAST DEPLOYED: Wed Dec 11 16:52:01 2019\nNAMESPACE: helloworld\nSTATUS: deployed\nREVISION: 1\n```\n\nThe `install.app` task will install your application in `helloworld` namespace.\nThe initial installation creates a Kubernetes deployment as well as a Kubernetes\nservice you can use to access the application.\n\nTo double check your app is deployed, run the following Helm command:\n\n```bash\n$ helm list\nNAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION\nhelloblah       default         1               2019-12-11 16:41:18.551571 -0800 PST    deployed        helloblah-0.1.0 0.1.0\n```\n\nAlternatively, you can use `kubectl` to check the created resources. With the\ncommand in the example below, we are getting all services and deployments from\nthe `helloworld` namespace that have a label called `app` set to `helloworld`:\n\n```bash\n$ kubectl get svc,deploy -l app=helloworld -n helloworld\nNAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE\nsvc/helloworld   ClusterIP   10.100.205.117   \u003cnone\u003e        80/TCP    2m\n\nNAME                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\ndeploy/helloworld   1         1         1            1           2m\n```\n\n## Interact with the app\n\nNow that your app is deployed and running in Kubernetes, you can interact with\nit. There are a couple of different ways you could interact with the app, the\nsimplest being Kubernetes proxy to create a connection to the cluster:\n\n```bash\n# Create a proxy to the cluster and run it in the background\n$ kubectl proxy \u0026\n\n# Access the deployed service through the proxy\n$ curl http://127.0.0.1:8001/api/v1/namespaces/helloworld/services/helloworld:http/proxy/\nHello\n```\n\nAnother way to access the service is to run a container inside the cluster and\nrun `curl` from there.\n\n```bash\n# This will give you a terminal inside the container running on the cluster\n$ kubectl run curl --image=radial/busyboxplus:curl -i --tty\n\n# Access the service 'helloworld' in namespace 'helloworld'\n$ curl helloworld.helloworld.svc.cluster.local\nHello\n```\n\n## Deploy app upgrades\n\nAs part of your dev workflow, you will be making changes to your app and you\nwould want to deploy those changes and test the app out. Let's say we updated\nthe code in `main.go` to return `Hello World` instead of just `Hello`. After\nyou've built your app (e.g. `make all`), the sequence of commands to deploy the\nupdated app would be something like this:\n\n```bash\n# (OPTIONAL) Bumps the version in VERSION.txt file\n$ make bump-version\n\n# Builds the new version of the image, pushes it to the registry and upgrades the app\n$ make upgrade\n```\n\nNow if you try to access the app you should get back `Hello World`.\n\n# Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to get\nstarted contributing to `kapp`.\n\n# License\n\n`kapp` is open source software [licensed as MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterj%2Fkapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterj%2Fkapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterj%2Fkapp/lists"}