{"id":13676838,"url":"https://github.com/kubernetes-up-and-running/kuard","last_synced_at":"2025-04-14T20:55:50.259Z","repository":{"id":42597251,"uuid":"78371142","full_name":"kubernetes-up-and-running/kuard","owner":"kubernetes-up-and-running","description":"Demo app for Kubernetes Up and Running book","archived":false,"fork":false,"pushed_at":"2024-01-03T06:02:23.000Z","size":2233,"stargazers_count":1648,"open_issues_count":19,"forks_count":549,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-07T15:04:22.815Z","etag":null,"topics":["golang","kubernetes","react"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubernetes-up-and-running.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-08T21:19:13.000Z","updated_at":"2025-04-02T04:42:27.000Z","dependencies_parsed_at":"2024-01-14T14:31:31.604Z","dependency_job_id":"72e51bd8-0f9c-4f7a-b4b4-a4c6d6a91cd4","html_url":"https://github.com/kubernetes-up-and-running/kuard","commit_stats":null,"previous_names":["jbeda/kuard"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-up-and-running%2Fkuard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-up-and-running%2Fkuard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-up-and-running%2Fkuard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-up-and-running%2Fkuard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubernetes-up-and-running","download_url":"https://codeload.github.com/kubernetes-up-and-running/kuard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961140,"owners_count":21189991,"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":["golang","kubernetes","react"],"created_at":"2024-08-02T13:00:33.613Z","updated_at":"2025-04-14T20:55:50.238Z","avatar_url":"https://github.com/kubernetes-up-and-running.png","language":"Go","funding_links":[],"categories":["Go","Kubernetes","Containers"],"sub_categories":["Kubernetes"],"readme":"# Demo application for \"Kubernetes Up and Running\"\n\n![screenshot](docs/images/screenshot.png)\n\n### Running\n\n```\nkubectl run --restart=Never --image=gcr.io/kuar-demo/kuard-amd64:blue kuard\nkubectl port-forward kuard 8080:8080\n```\n\nOpen your browser to [http://localhost:8080](http://localhost:8080).\n\n### Building\n\nWe have ~3 ways to build.\nThis has changed slightly from when the book is published so I'd view this as authoritative.\n\n#### Insert Binary\n\nThis aligns with what is in the book.\nYou need to build the binary to run *somehow* and then insert it into a Docker image.\nThe easiest way to do this is to use the fully automated make system to build the binary and then create a Dockerfile for creating an image.\n\nCreate the binary by typing `make` at the command line. This'll build a docker image and then run it to compile the binary.\n\nNow create a minimal Dockerfile to contain that binary:\n\n```\nFROM alpine\nCOPY bin/blue/amd64/kuard /kuard\nENTRYPOINT [ \"/kuard\" ]\n```\n\nOverwrite `Dockerfile` with this and then run `docker build -t kuard-amd64:blue .`.\nRun with `docker run --rm -ti --name kuard --publish 8080:8080 kuard-amd64:blue`.\n\nTo upload to a registry you'll have to tag it and push to your registry.  Refer to your registry documentation for details.\n\n#### Multi-stage Dockerfile\n\nA new feature of Docker, since the book was published, is a \"multi-stage\" build.\nThis is a way to run build multiple images and then copy files between them.\n\nThe `Dockerfile` at the root of this repo is an example of that.\nIt creates one image to build kuard and then another image for running kuard.\n\nYou can easily build an image with `docker build -t kuard-amd64:blue .`.\nRun with `docker run --rm -ti --name kuard --publish 8080:8080 kuard-amd64:blue`.\n\nTo upload to a registry you'll have to tag it and push to your registry.  Refer to your registry documentation for details.\n\n#### Fancy Makefile for automated build and push\n\nThis will build and push container images to a registry.\nThis builds a set of images with \"fake versions\" (see below) to be able to play with upgrades.\n\n```\nmake all-push REGISTRY=\u003cmy-gcr-registry\u003e\n```\n\nIf you are having trouble, try issuing a `make clean` to reset stuff.\n\n### KeyGen Workload\n\nTo help simulate batch workers, we have a synthetic workload of generating 4096 bit RSA keys.  This can be configured through the UI or the command line.\n\n```\n--keygen-enable               Enable KeyGen workload\n--keygen-exit-code int        Exit code when workload complete\n--keygen-exit-on-complete     Exit after workload is complete\n--keygen-memq-queue string    The MemQ server queue to use. If MemQ is used, other limits are ignored.\n--keygen-memq-server string   The MemQ server to draw work items from.  If MemQ is used, other limits are ignored.\n--keygen-num-to-gen int       The number of keys to generate. Set to 0 for infinite\n--keygen-time-to-run int      The target run time in seconds. Set to 0 for infinite\n```\n\n### MemQ server\n\nWe also have a simple in memory queue with REST API.  This is based heavily on https://github.com/kelseyhightower/memq.\n\nThe API is as follows with URLs being relative to `\u003cserver addr\u003e/memq/server`.  See `pkg/memq/types.go` for the data structures returned.\n\n| Method | Url | Desc\n| --- | --- | ---\n| `GET` | `/stats` | Get stats on all queues\n| `PUT` | `/queues/:queue` | Create a queue\n| `DELETE` | `/queues/:queue` | Delete a queue\n| `POST` | `/queues/:queue/drain` | Discard all items in queue\n| `POST` | `/queues/:queue/enqueue` | Add item to queue.  Body is plain text. Response is message object.\n| `POST` | `/queues/:queue/dequeue` | Grab an item off the queue and return it. Returns a 204 \"No Content\" if queue is empty.\n\n### Versions\n\nImages built will automatically have the git version (based on tag) applied.  In addition, there is an idea of a \"fake version\".  This is used so that we can use the same basic server to demonstrate upgrade scenarios.\n\nOriginally (and in the Kubernetes Up \u0026 Running book) we had `1`, `2`, and `3`.  This confused people so going forward we will be using colors instead: `blue`, `green` and `purple`. This translates into the following container images:\n\n```\ngcr.io/kuar-demo/kuard-amd64:v0.9-blue\ngcr.io/kuar-demo/kuard-amd64:blue\ngcr.io/kuar-demo/kuard-amd64:v0.9-green\ngcr.io/kuar-demo/kuard-amd64:green\ngcr.io/kuar-demo/kuard-amd64:v0.9-purple\ngcr.io/kuar-demo/kuard-amd64:purple\n```\n\nFor documentation where you want to demonstrate using versions but use the latest version of this server, you can simply reference `gcr.io/kuar-demo/kuard-amd64:blue`.  You can then demonstrate an upgrade with `gcr.io/kuar-demo/kuard-amd64:green`.\n\n(Another way to think about it is that `:blue` is essentially `:latest-blue`)\n\nWe also build versions for `arm`, `arm64`, and `ppc64le`.  Just substitute the appropriate architecture in the image name.  These aren't as well tested as the `amd64` version but seem to work okay.\n\n### Development\n\nIf you just want to do Go server development, you can build the client as part of a build `make`.  It'll drop the result in to `sitedata/built/`.\n\nIf you want to do both Go server and React.js client dev, you need to do the following:\n\n1. Have Node installed\n2. In one terminal\n\n  * `cd client`\n  * `npm install`\n  * `npm run start`\n  * This will start a debug node server on `localhost:8081`.  It'll proxy all unhandled requests to `localhost:8080`\n\n3. In another terminal\n  * Ensure that $GOPATH is set to the directory with your go source code and binaries + ensure that $GOPATH is part of $PATH.\n  * `go get -u github.com/jteeuwen/go-bindata/...`\n  * `go generate ./pkg/...`\n  * `GO111MODULE=on go run cmd/kuard/*.go --debug`\n4. Open your browser to http://localhost:8081.\n\nThis should support live reload of any changes to the client.  The Go server will need to be exited and restarted to see changes.\n\n### TODO\n* [ ] Make file system browser better.  Show size, permissions, etc.  Might be able to do this by faking out an `index.html` as part of the http.FileSystem stuff.\n* [ ] Clean up form for keygen workload.  It is too big and the form build doesn't have enough flexibility to really shrink it down.\n* [ ] Get rid of go-bindata as it is abandoned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-up-and-running%2Fkuard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubernetes-up-and-running%2Fkuard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-up-and-running%2Fkuard/lists"}