Code Monkey home page Code Monkey logo

kuard's People

Contributors

agrimprasad avatar djfrmd avatar gkleiman avatar jbeda avatar praxiscode avatar rrenshaw avatar sslavic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kuard's Issues

make build fails on Fedora 27

I am trying to follow along in the book

Docker is from Fedora repo. Daemon is up and running. hello-world container ran fine and gave some output on screen.

But I get errors on following steps outlined in README.md

[root@kube1 01]# git clone https://github.com/kubernetes-up-and-running/kuard
Cloning into 'kuard'...
remote: Counting objects: 1303, done.
remote: Total 1303 (delta 0), reused 0 (delta 0), pack-reused 1303
Receiving objects: 100% (1303/1303), 2.08 MiB | 580.00 KiB/s, done.
Resolving deltas: 100% (428/428), done.
[root@kube1 01]# ls
Dockerfile kuard
[root@kube1 01]# cd kuard
[root@kube1 kuard]# ls
build client cmd Dockerfile.build Dockerfile.kuard docs Godeps LICENSE Makefile pkg README.md rules.mk sitedata testscripts vendor
[root@kube1 kuard]# make build
container: kuard-build
/usr/bin/docker-current: Error response from daemon: invalid bind mount spec "kuard-build-data:/data:delegated": invalid mode: delegated.
See '/usr/bin/docker-current run --help'.
make: *** [rules.mk:93: .kuard-build-container] Error 125

Getting an error `/go/bin/kuard` in chapter 2 Multistage image builds

I am using a Macbook air with M1 chip.
I cloned the git repo and tried building it using the docker command docker build . -t kuard. I got the following error:

 => ERROR [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                                                                                                                      0.0s
------
 > [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
failed to compute cache key: "/go/bin/kuard" not found: not found
Full logs
➜  kuard git:(master) docker build . -t kuard
[+] Building 1.4s (16/16) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.1s
 => => transferring dockerfile: 37B                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 34B                                                                                                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                                                                                    1.0s
 => [internal] load metadata for docker.io/library/golang:1.12-alpine                                                                                                                                                                                                               1.1s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [internal] load build context                                                                                                                                                                                                                                                   0.1s
 => => transferring context: 6.05kB                                                                                                                                                                                                                                                 0.1s
 => [build 1/7] FROM docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                                                                                                                                   0.0s
 => CACHED [stage-1 1/2] FROM docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                                                                                                                                                      0.0s
 => CACHED [build 2/7] RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm                                                                                                                                                                                      0.0s
 => CACHED [build 3/7] RUN go get -u github.com/jteeuwen/go-bindata/...                                                                                                                                                                                                             0.0s
 => CACHED [build 4/7] WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard                                                                                                                                                                                                   0.0s
 => CACHED [build 5/7] COPY . .                                                                                                                                                                                                                                                     0.0s
 => CACHED [build 6/7] RUN dos2unix build/build.sh                                                                                                                                                                                                                                  0.0s
 => CACHED [build 7/7] RUN build/build.sh                                                                                                                                                                                                                                           0.0s
 => ERROR [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                                                                                                                      0.0s
------
 > [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
failed to compute cache key: "/go/bin/kuard" not found: not found

I tried building using amd64 platform but still got the same error.
Command I ran: docker buildx build --platform linux/amd64,linux/arm64 .
The error I got:

 => CANCELED [linux/amd64 build 7/7] RUN build/build.sh                                                                                                                                                                                                                            50.9s
 => ERROR [linux/arm64 stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                                                                                                          0.0s
------
 > [linux/arm64 stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
Dockerfile:31
--------------------
  29 |
  30 |     USER nobody:nobody
  31 | >>> COPY --from=build /go/bin/kuard /kuard
  32 |
  33 |     CMD [ "/kuard" ]
--------------------
error: failed to solve: failed to compute cache key: "/go/bin/kuard": not found
Full logs
➜  kuard git:(master) docker buildx build --platform linux/amd64,linux/arm64 .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 52.9s (28/29)
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 808B                                                                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 64B                                                                                                                                                                                                                                                    0.0s
 => [linux/arm64 internal] load metadata for docker.io/library/golang:1.12-alpine                                                                                                                                                                                                   1.3s
 => [linux/arm64 internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                                                                        1.3s
 => [linux/amd64 internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                                                                        1.4s
 => [linux/amd64 internal] load metadata for docker.io/library/golang:1.12-alpine                                                                                                                                                                                                   1.3s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                                                                                                                       0.0s
 => [linux/amd64 build 1/7] FROM docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                                                                                                                       0.0s
 => => resolve docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                                                                                                                                         0.0s
 => CACHED [linux/amd64 stage-1 1/2] FROM docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                                                                                                                                          0.0s
 => => resolve docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                                                                                                                                                                     0.0s
 => CACHED [linux/arm64 stage-1 1/2] FROM docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                                                                                                                                          0.0s
 => => resolve docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                                                                                                                                                                     0.0s
 => [linux/arm64 build 1/7] FROM docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                                                                                                                       0.0s
 => => resolve docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                                                                                                                                   0.1s
 => => transferring context: 311.84kB                                                                                                                                                                                                                                               0.1s
 => CACHED [linux/arm64 build 2/7] RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm                                                                                                                                                                          0.0s
 => CACHED [linux/arm64 build 3/7] RUN go get -u github.com/jteeuwen/go-bindata/...                                                                                                                                                                                                 0.0s
 => CACHED [linux/arm64 build 4/7] WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard                                                                                                                                                                                       0.0s
 => CACHED [linux/amd64 build 2/7] RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm                                                                                                                                                                          0.0s
 => CACHED [linux/amd64 build 3/7] RUN go get -u github.com/jteeuwen/go-bindata/...                                                                                                                                                                                                 0.0s
 => CACHED [linux/amd64 build 4/7] WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard                                                                                                                                                                                       0.0s
 => [linux/amd64 build 5/7] COPY . .                                                                                                                                                                                                                                                0.2s
 => [linux/arm64 build 5/7] COPY . .                                                                                                                                                                                                                                                0.2s
 => [linux/amd64 build 6/7] RUN dos2unix build/build.sh                                                                                                                                                                                                                             0.2s
 => [linux/arm64 build 6/7] RUN dos2unix build/build.sh                                                                                                                                                                                                                             0.2s
 => [linux/arm64 build 7/7] RUN build/build.sh                                                                                                                                                                                                                                     50.7s
 => CANCELED [linux/amd64 build 7/7] RUN build/build.sh                                                                                                                                                                                                                            50.9s
 => ERROR [linux/arm64 stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                                                                                                          0.0s
------
 > [linux/arm64 stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
Dockerfile:31
--------------------
  29 |
  30 |     USER nobody:nobody
  31 | >>> COPY --from=build /go/bin/kuard /kuard
  32 |
  33 |     CMD [ "/kuard" ]
--------------------
error: failed to solve: failed to compute cache key: "/go/bin/kuard": not found

The code ran fine on my work laptop(Macbook pro without the M1 chip)

Could someone help me with resolving this, I am really looking forward to reading this book but I am not able to run this project 😞

Fails to start if using runAsNonRoot:true

The use of USER nobody:nobody in default image will cause a kublet startup failure if runAsNonRoot:true SecurityContext is applied or enforced via a PSP.

ie from describe:

Warning  Failed     7s (x3 over 22s)  kubelet            Error: container has runAsNonRoot and image has non-numeric user (nobody), cannot verify user is non-root (pod: "kuard-798585497b-4lpqf_default(6e554b4c-4f39-4fae-97c6-b147436639f4)", container: kuard)

Need to use numeric UID:GID in Dockerfile(s) to avoid this or else users will have to hard code them into runAsUser lines in their pod specs.

[Feature Request] Provide a JSON endpoint for the Pod's environment

I may have missed this but, it would be useful to serve a JSON endpoint to facilitate use of e.g. curl.

I deployed kuard and then wanted to show different Pods responding behind Load-Balanced requests. Unaware of a JSON endpoint, I would have had to parse e.g. HOSTNAME from the HTML. Not impossible but it'd be sweet to have JSON results.

Could not find certificates to serve TLS

Started the container (docker run --rm -p 8080:8000 kuart) and got the following output

2019/10/18 16:28:50 Starting kuard version: test
2019/10/18 16:28:50 **********************************************************************
2019/10/18 16:28:50 * WARNING: This server may expose sensitive
2019/10/18 16:28:50 * and secret information. Be careful.
2019/10/18 16:28:50 **********************************************************************
2019/10/18 16:28:50 Config:
{
  "address": ":8080",
  "debug": false,
  "debug-sitedata-dir": "./sitedata",
  "keygen": {
    "enable": false,
    "exit-code": 0,
    "exit-on-complete": false,
    "memq-queue": "",
    "memq-server": "",
    "num-to-gen": 0,
    "time-to-run": 0
  },
  "liveness": {
    "fail-next": 0
  },
  "readiness": {
    "fail-next": 0
  },
  "tls-address": ":8443",
  "tls-dir": "/tls"
}
2019/10/18 16:28:50 Could not find certificates to serve TLS
2019/10/18 16:28:50 Serving on HTTP on :8080

Any ideas what needs to be in place for this to work?

make build gives repository lowercase error

Just cloned a clean repository and when I run

make build

I get

container: kuard-build
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
make: *** [.kuard-build-container] Error 125

build.sh: not found

Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[1/2] STEP 1/13: FROM golang:1.17-alpine AS build
[1/2] STEP 2/13: RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm
--> Using cache 9c197f4e791a9958d4cb7f766ce967e151beabad49d3bb149242172e6306a133
--> 9c197f4e791
[1/2] STEP 3/13: RUN go get -u github.com/jteeuwen/go-bindata/...
--> Using cache 2c19a9860e80b2505adb1d49e944e30cafa0bb364a3458b625cce90daf62ce73
--> 2c19a9860e8
[1/2] STEP 4/13: RUN go get github.com/tools/godep
--> Using cache 33b8137d6f393cfeec2e40a677094bc9d42536ba07c09667294be62ff325b65a
--> 33b8137d6f3
[1/2] STEP 5/13: RUN go get github.com/kubernetes-up-and-running/kuard
--> Using cache ed77655f1a9c4e4fa6aa30fc69dbf14d0f7785bba4460b499c56dbaf7497b073
--> ed77655f1a9
[1/2] STEP 6/13: WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard
--> Using cache a77ee93c189674aca28e0b6e8f4fe0c9c87882e16995d2d8a809fae33e7c8dc5
--> a77ee93c189
[1/2] STEP 7/13: COPY . .
--> Using cache c70ff6f35a3a6a34acbd9838fc2b9250c155078ea7924d3346a83b497b9ec4a9
--> c70ff6f35a3
[1/2] STEP 8/13: ENV VERBOSE=0
--> Using cache 5246faebb47be5deb520fed5ad960858816a5be096c93632b096c4e4eb32dd3d
--> 5246faebb47
[1/2] STEP 9/13: ENV PKG=github.com/kubernetes-up-and-running/kuard
--> Using cache 1082633b1420cb6d147428b68d26d888e2a23b68cd9d8007b74569dad9a4d1c6
--> 1082633b142
[1/2] STEP 10/13: ENV ARCH=amd64
--> Using cache 280e5b84381a02a4194526f8afbbce68428775dea04a25542ad89f870843144e
--> 280e5b84381
[1/2] STEP 11/13: ENV VERSION=test
--> Using cache 9fce4dd8d57726f9184523397a1782317a8c02c84684f199d28612182fd2633a
--> 9fce4dd8d57
[1/2] STEP 12/13: RUN build/build.sh
/bin/sh: build/build.sh: not found
Error: error building at STEP "RUN build/build.sh": error while running runtime: exit status 127

Can not create Pod

Hi,

I am not able to create pod, I tried both yaml configuration and docker run (page 49 second edition). I am getting:

docker run -d --name kuard --publish 8080:8080 gcr.io/kuard-demo/kuard-amd64:blue
Unable to find image 'gcr.io/kuard-demo/kuard-amd64:blue' locally
docker: Error response from daemon: Head https://gcr.io/v2/kuard-demo/kuard-amd64/manifests/blue: unknown: Project 'project:kuard-demo' not found or deleted.

It is appreciated to let me know how to fix that issue.

expose kuard through a reverse proxy

If kuard is exposed through a reverse proxy subpath, eg: mysite.com/kuard, statics ressources requests failed with error http/404.
Could you please add a parameter root_url to set the full URL to access kuard from a web browser ?

Executor fails to run build/build.sh

Context:

  • Following along book Chapter 2: Creating and Running Containers
  • MacBook Pro M1 Apple Silicon macOS Big Sur 11.5
  • Git clone repo locally
  • In Dockerfile, changed ENV ARCH => arm64
  • run docker build -t kuard .

Got the following error:

❯ docker build -t kuard .
[+] Building 34.9s (14/15)
=> [internal] load build definition from Dockerfile 0.3s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.5s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 1.3s
=> [internal] load metadata for docker.io/library/golang:1.12-alpine 1.4s
=> [auth] library/alpine:pull token for registry-1.docker.io 0.0s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> CACHED [stage-1 1/2] FROM docker.io/library/alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0 0.0s
=> [build 1/6] FROM docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 17.82kB 0.0s
=> CACHED [build 2/6] RUN apk update && apk upgrade && apk add --no-cache build-base git nodejs bash npm 0.0s
=> CACHED [build 3/6] RUN go get -u github.com/jteeuwen/go-bindata/... 0.0s
=> CACHED [build 4/6] WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard 0.0s
=> [build 5/6] COPY . . 0.6s
=> ERROR [build 6/6] RUN build/build.sh 31.9s


[build 6/6] RUN build/build.sh:
#14 0.882 Verbose: 0
#14 8.472
#14 8.472 > [email protected] postinstall /go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules/webpack-cli
#14 8.472 > lightercollective
#14 8.472
#14 8.503
#14 8.504 *** Thank you for using webpack-cli! ***
#14 8.504
#14 8.504 Please consider donating to our open collective
#14 8.504 to help us maintain this package.
#14 8.504
#14 8.504 https://opencollective.com/webpack/donate
#14 8.504
#14 8.504 ***
#14 8.504
#14 8.930 added 819 packages from 505 contributors and audited 887 packages in 7.777s
#14 9.158 found 864 vulnerabilities (428 low, 12 moderate, 424 high)
#14 9.158 run npm audit fix to fix them, or npm audit for details
#14 9.383
#14 9.383 > [email protected] build /go/src/github.com/kubernetes-up-and-running/kuard/client
#14 9.383 > webpack --mode=production
#14 9.383
#14 10.01 Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist
#14 13.47 Hash: 52ca742bfd1307531486
#14 13.47 Version: webpack 4.28.4
#14 13.47 Time: 3647ms
#14 13.47 Built at: 07/25/2021 2:48:25 PM
#14 13.47 Asset Size Chunks Chunk Names
#14 13.47 bundle.js 333 KiB 0 [emitted] [big] main
#14 13.47 Entrypoint main [big] = bundle.js
#14 13.47 [26] (webpack)/buildin/global.js 472 bytes {0} [built]
#14 13.47 [228] (webpack)/buildin/module.js 497 bytes {0} [built]
#14 13.47 [236] (webpack)/buildin/amd-options.js 80 bytes {0} [built]
#14 13.47 [252] ./src/index.jsx + 12 modules 57.6 KiB {0} [built]
#14 13.47 | ./src/index.jsx 285 bytes [built]
#14 13.47 | ./src/app.jsx 7.79 KiB [built]
#14 13.47 | ./src/env.jsx 5.42 KiB [built]
#14 13.47 | ./src/mem.jsx 5.81 KiB [built]
#14 13.47 | ./src/probe.jsx 7.64 KiB [built]
#14 13.47 | ./src/dns.jsx 5.1 KiB [built]
#14 13.47 | ./src/keygen.jsx 7.69 KiB [built]
#14 13.47 | ./src/request.jsx 3.01 KiB [built]
#14 13.47 | ./src/highlightlink.jsx 1.37 KiB [built]
#14 13.47 | ./src/disconnected.jsx 3.6 KiB [built]
#14 13.47 | ./src/memq.jsx 6.33 KiB [built]
#14 13.47 | ./src/fetcherror.js 122 bytes [built]
#14 13.47 | ./src/markdown.jsx 3.46 KiB [built]
#14 13.47 + 249 hidden modules
#14 13.57 go: finding github.com/dustin/go-humanize v1.0.0
#14 13.58 go: finding github.com/prometheus/client_golang v0.9.2
#14 13.58 go: finding github.com/elazarl/go-bindata-assetfs v1.0.0
#14 13.58 go: finding github.com/julienschmidt/httprouter v1.2.0
#14 13.58 go: finding github.com/BurntSushi/toml v0.3.1
#14 13.58 go: finding github.com/pkg/errors v0.8.1
#14 13.58 go: finding github.com/spf13/pflag v1.0.3
#14 13.58 go: finding github.com/spf13/viper v1.3.2
#14 13.58 go: finding github.com/miekg/dns v1.1.6
#14 13.90 go: finding golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
#14 14.35 go: finding github.com/felixge/httpsnoop v1.0.0
#14 14.51 go: finding github.com/pelletier/go-toml v1.2.0
#14 14.51 go: finding github.com/hashicorp/hcl v1.0.0
#14 14.51 go: finding github.com/stretchr/testify v1.2.2
#14 14.51 go: finding github.com/spf13/jwalterweatherman v1.0.0
#14 14.51 go: finding github.com/coreos/go-etcd v2.0.0+incompatible
#14 14.52 go: finding golang.org/x/text v0.3.0
#14 14.64 go: finding github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
#14 14.86 go: finding github.com/magiconair/properties v1.8.0
#14 15.04 go: finding github.com/golang/protobuf v1.2.0
#14 15.14 go: finding github.com/spf13/cast v1.3.0
#14 15.34 go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
#14 15.53 go: finding golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a
#14 15.53 go: finding github.com/mitchellh/mapstructure v1.1.2
#14 15.72 go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
#14 15.76 go: finding github.com/fsnotify/fsnotify v1.4.7
#14 15.80 go: finding github.com/spf13/afero v1.1.2
#14 15.84 go: finding github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
#14 16.23 go: finding github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6
#14 16.30 go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
#14 16.34 go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
#14 16.34 go: finding github.com/coreos/etcd v3.3.10+incompatible
#14 16.64 go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
#14 16.74 go: finding github.com/davecgh/go-spew v1.1.1
#14 16.95 go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
#14 16.98 go: finding github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8
#14 17.06 go: finding github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77
#14 17.30 go: finding gopkg.in/yaml.v2 v2.2.2
#14 17.61 go: finding golang.org/x/net v0.0.0-20181201002055-351d144fa1fc
#14 17.98 go: finding github.com/pmezard/go-difflib v1.0.0
#14 18.09 go: finding github.com/coreos/go-semver v0.2.0
#14 20.06 go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
#14 23.81 go: downloading github.com/pkg/errors v0.8.1
#14 23.81 go: downloading github.com/julienschmidt/httprouter v1.2.0
#14 23.82 go: downloading github.com/miekg/dns v1.1.6
#14 23.83 go: downloading github.com/dustin/go-humanize v1.0.0
#14 23.83 go: downloading github.com/spf13/pflag v1.0.3
#14 23.84 go: downloading golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
#14 23.85 go: downloading github.com/elazarl/go-bindata-assetfs v1.0.0
#14 23.86 go: downloading github.com/prometheus/client_golang v0.9.2
#14 23.87 go: downloading github.com/spf13/viper v1.3.2
#14 23.87 go: downloading github.com/felixge/httpsnoop v1.0.0
#14 23.97 go: extracting github.com/pkg/errors v0.8.1
#14 24.01 go: extracting github.com/dustin/go-humanize v1.0.0
#14 24.01 go: extracting github.com/spf13/pflag v1.0.3
#14 24.01 go: extracting github.com/felixge/httpsnoop v1.0.0
#14 24.01 go: extracting github.com/elazarl/go-bindata-assetfs v1.0.0
#14 24.01 go: extracting github.com/julienschmidt/httprouter v1.2.0
#14 24.05 go: extracting github.com/prometheus/client_golang v0.9.2
#14 24.05 go: extracting github.com/spf13/viper v1.3.2
#14 24.05 go: downloading github.com/fsnotify/fsnotify v1.4.7
#14 24.05 go: downloading gopkg.in/yaml.v2 v2.2.2
#14 24.05 go: downloading github.com/mitchellh/mapstructure v1.1.2
#14 24.05 go: downloading github.com/spf13/jwalterweatherman v1.0.0
#14 24.05 go: downloading github.com/hashicorp/hcl v1.0.0
#14 24.05 go: downloading github.com/magiconair/properties v1.8.0
#14 24.06 go: downloading github.com/pelletier/go-toml v1.2.0
#14 24.08 go: downloading github.com/golang/protobuf v1.2.0
#14 24.22 go: extracting github.com/spf13/jwalterweatherman v1.0.0
#14 24.22 go: extracting github.com/magiconair/properties v1.8.0
#14 24.23 go: downloading github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
#14 24.23 go: downloading github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
#14 24.26 go: extracting github.com/fsnotify/fsnotify v1.4.7
#14 24.26 go: extracting github.com/hashicorp/hcl v1.0.0
#14 24.26 go: extracting github.com/pelletier/go-toml v1.2.0
#14 24.26 go: extracting github.com/mitchellh/mapstructure v1.1.2
#14 24.26 go: extracting gopkg.in/yaml.v2 v2.2.2
#14 24.27 go: downloading github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
#14 24.27 go: downloading github.com/spf13/cast v1.3.0
#14 24.27 go: downloading github.com/spf13/afero v1.1.2
#14 24.28 go: downloading golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
#14 24.31 go: extracting golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a
#14 24.34 go: downloading github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
#14 24.35 go: extracting github.com/golang/protobuf v1.2.0
#14 24.39 go: extracting github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
#14 24.39 go: extracting github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
#14 24.40 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
#14 24.43 go: extracting github.com/spf13/cast v1.3.0
#14 24.43 go: extracting github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
#14 24.43 go: extracting github.com/spf13/afero v1.1.2
#14 24.43 go: downloading golang.org/x/text v0.3.0
#14 24.47 go: extracting github.com/miekg/dns v1.1.6
#14 24.48 go: downloading golang.org/x/net v0.0.0-20181201002055-351d144fa1fc
#14 24.51 go: extracting github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
#14 24.54 go: extracting github.com/matttproud/golang_protobuf_extensions v1.0.1
#14 24.77 go: extracting golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
#14 24.89 go: extracting golang.org/x/net v0.0.0-20181201002055-351d144fa1fc
#14 26.17 go: extracting golang.org/x/text v0.3.0
#14 26.58 # github.com/kubernetes-up-and-running/kuard/pkg/version
#14 26.58 pkg/version/version.go:19:5: VERSION redeclared in this block
#14 26.58 previous declaration at pkg/version/version 2.go:19:5
#14 27.36 # github.com/kubernetes-up-and-running/kuard/pkg/memq
#14 27.36 pkg/memq/types.go:21:6: Stats redeclared in this block
#14 27.36 previous declaration at pkg/memq/types 2.go:21:6
#14 27.36 pkg/memq/types.go:26:6: Stat redeclared in this block
#14 27.36 previous declaration at pkg/memq/types 2.go:26:6
#14 27.36 pkg/memq/types.go:34:6: Message redeclared in this block
#14 27.36 previous declaration at pkg/memq/types 2.go:34:6
#14 30.02 # github.com/kubernetes-up-and-running/kuard/pkg/apiutils
#14 30.02 pkg/apiutils/utils.go:25:6: ServeJSON redeclared in this block
#14 30.02 previous declaration at pkg/apiutils/utils 2.go:25:41
#14 30.02 pkg/apiutils/utils.go:31:5: epoch redeclared in this block
#14 30.02 previous declaration at pkg/apiutils/utils 2.go:31:5
#14 30.02 pkg/apiutils/utils.go:32:5: noCacheHeaders redeclared in this block
#14 30.02 previous declaration at pkg/apiutils/utils 2.go:32:5
#14 30.02 pkg/apiutils/utils.go:38:6: NoCache redeclared in this block
#14 30.02 previous declaration at pkg/apiutils/utils 2.go:38:16
#14 30.18 # github.com/kubernetes-up-and-running/kuard/pkg/sitedata
#14 30.18 pkg/sitedata/sitedata.go:31:5: debug redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:31:5
#14 30.18 pkg/sitedata/sitedata.go:32:5: debugRootDir redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:32:5
#14 30.18 pkg/sitedata/sitedata.go:34:6: SetConfig redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:34:28
#14 30.18 pkg/sitedata/sitedata.go:39:6: GetStaticHandler redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:39:38
#14 30.18 pkg/sitedata/sitedata.go:43:14: GetStaticHandler.func1 redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:43:14
#14 30.18 pkg/sitedata/sitedata.go:49:9: GetStaticHandler.func2 redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:49:9
#14 30.18 pkg/sitedata/sitedata.go:60:6: AddRoutes redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:60:45
#14 30.18 pkg/sitedata/sitedata.go:64:6: LoadFilesInDir redeclared in this block
#14 30.18 previous declaration at pkg/sitedata/sitedata 2.go:64:53


executor failed running [/bin/sh -c build/build.sh]: exit code: 2

Any help is appreciated thank you

Build Error with Kaurd "/go/bin/kuard": not found

I am on page 24 of Kubernetes up and Running, I am trying to run the example app for the first time.

git clone https://github.com/kubernetes-up-and-running/kuard
cd kuard
docker build -t kuard .

I get the following error...

 => ERROR [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard                                                                                                                      0.0s
------
 > [stage-1 2/2] COPY --from=build /go/bin/kuard /kuard:
------
Dockerfile:31
--------------------
  29 |
  30 |     USER nobody:nobody
  31 | >>> COPY --from=build /go/bin/kuard /kuard
  32 |
  33 |     CMD [ "/kuard" ]
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 1670e558-a5e0-44b8-90d8-a38b092afef2::bvhmpv59qxdu9ec710i1goekg: "/go/bin/kuard": not found

What can I do to resolve?

Issue with initial dockerfile in KUAR chapter 2

There are instructions in chapter 2 for create a simple dockerfile that will create an image for the user. In the file, there is a command to copy from source bin/kuard to a place on your local machine. My instance of docker is throwing an error:

"stat /var/lib/docker/tmp/docker-builder803175328/bin/kuard: no such file or directory"

Has this directory been updated in some way?

make images fails to build on Apple silicon

Seeing the following error on M1 based MacBook Pro where same commit works fine on an Intel based machine.

> make images
container image: kuard-build
  Building container image
[+] Building 0.0s (9/9) FINISHED                                                                                                                                            
 => [internal] load build definition from Dockerfile.build                                                                                                             0.0s
 => => transferring dockerfile: 1.34kB                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 34B                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/golang:1.12-alpine                                                                                                  0.3s
 => [1/6] FROM docker.io/library/golang:1.12-alpine@sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a                                            0.0s
 => CACHED [2/6] WORKDIR /data                                                                                                                                         0.0s
 => CACHED [3/6] RUN for ARCH in amd64 arm arm64 ppc64le; do       ln -s -f "/data/std/${ARCH}" "/usr/local/go/pkg/linux_${ARCH}_static" ;     done                    0.0s
 => CACHED [4/6] RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm                                                                               0.0s
 => CACHED [5/6] RUN GOPATH=/tmp GOBIN=/usr/local/bin go get -u github.com/jteeuwen/go-bindata/...                                                                     0.0s
 => ERROR [6/6] RUN GOPATH=/tmp GOBIN=/usr/local/bin go get github.com/tools/godep                                                                                     1.3s
------
 > [6/6] RUN GOPATH=/tmp GOBIN=/usr/local/bin go get github.com/tools/godep:
#9 1.324 # github.com/tools/godep
#9 1.324 /usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exec: "gcc": executable file not found in $PATH
#9 1.324 
------
executor failed running [/bin/sh -c GOPATH=/tmp GOBIN=/usr/local/bin go get github.com/tools/godep]: exit code: 2
make: *** [.kuard-build-image] Error 1

build.sh not found when doing docker build

Hi,
I followed the procedures of multi-stage image build described in chapter 2 but was getting the build.sh not found problem.

$ docker build -t kuard .
.......
Step 11/12 : RUN build/build.sh
---> Running in 1119265327a0
/bin/sh: build/build.sh: not found

Did I miss anything or should I modify something rather than copy paste the content of the Dockerfile? Do I need to clone the the ./kuard to /go/src/github.com/kubernetes-up-and-running/kuard onto my Mac local filesystem? / is read-only on macOS Catalina BTW.
Thanks!

Labels and Annotations

Hi,

I wonder the command kubectl get deployments --show-labels does not work on my machine.
No resources found in default namespace.

On the pods level it looks ok

kubectl get pods --show-labels                                                                                                      ─╯
NAME                READY   STATUS    RESTARTS   AGE   LABELS
alpaca-prod         1/1     Running   0          23m   app=alpaca,env=prod,ver=1
alpaca-test         1/1     Running   0          23m   app=alpaca,canary=true,env=test,ver=2
bandicoot-prod      1/1     Running   0          23m   app=bandicoot,env=prod,ver=2
bandicoot-staging   1/1     Running   0          22m   app=bandicoot,env=staging,ver=2
kuard               1/1     Running   0          99m   <none>

By creation I had to remove the replicas flag.

kubectl run alpaca-prod --image=gcr.io/kuar-demo/kuard-amd64:blue --labels="ver=1,app=alpaca,env=prod"

Has something changed in the logic of deployment?

Thanks,
Markus

ssh tunneling issue on gcloud

OS : Windows 10
GCloud SDK
I exposed alpaca-prod by following instructions. You can see the specs of the service:

Name: alpaca-prod
Namespace: default
Labels: app=alpaca
env=prod
ver=1
Annotations:
Selector: app=alpaca,env=prod,ver=1
Type: NodePort
IP: 10.39.255.181
Port: 8080/TCP
TargetPort: 8080/TCP
NodePort: 31824/TCP
Endpoints: 10.36.0.24:8080,10.36.1.18:8080,10.36.2.17:8080
Session Affinity: None
External Traffic Policy: Cluster
Events:

nodes are:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
gke-kuar-cluster-default-pool-1ef29ffa-5cms Ready 12d v1.9.7-gke.11
gke-kuar-cluster-default-pool-1ef29ffa-trv0 Ready 12d v1.9.7-gke.11
gke-kuar-cluster-default-pool-1ef29ffa-vr99 Ready 12d v1.9.7-gke.11

When I try to run ssh tunneling command it says

ssh gke-kuar-cluster-default-pool-1ef29ffa-5cms -L 8080:localhost:31824
omer@gke-kuar-cluster-default-pool-1ef29ffa-5cms: Permission denied (publickey).

Error building Dockerfile buffer.js:606 slice: (buf, start, end) => buf.utf8Slice(start, end) RangeError: Index out of range

Hi,

I am trying to build this image on docker running on a Centos 8, but it is failing.

Env
CentOS Linux release 8.2.2004 (Core)
Docker version 19.03.13, build 4484c46d9d

1 git clone http://github.com/kubernetes-up-and-running/kuard
2 cd kuard
3 docker build -t kuard .

The output:
Sending build context to Docker daemon 3.39MB
Step 1/14 : FROM golang:1.12-alpine AS build
1.12-alpine: Pulling from library/golang
c9b1b535fdd9: Pull complete
cbb0d8da1b30: Pull complete
d909eff28200: Pull complete
665fbbf998e4: Pull complete
4985b1919860: Pull complete
Digest: sha256:3f8e3ad3e7c128d29ac3004ac8314967c5ddbfa5bfa7caa59b0de493fc01686a
Status: Downloaded newer image for golang:1.12-alpine
---> 76bddfb5e55e
Step 2/14 : RUN apk update && apk upgrade && apk add --no-cache git nodejs bash npm
---> Running in fa07a631bfe0
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.6-152-g533c9acbc3 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.6-153-g97339edd5c [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11276 distinct packages available
Upgrading critical system libraries and apk-tools:
(1/1) Upgrading apk-tools (2.10.4-r3 -> 2.10.5-r0)
Executing busybox-1.31.1-r9.trigger
Continuing the upgrade transaction with new apk-tools:
(1/6) Upgrading musl (1.1.24-r0 -> 1.1.24-r2)
(2/6) Upgrading libcrypto1.1 (1.1.1d-r3 -> 1.1.1g-r0)
(3/6) Upgrading libssl1.1 (1.1.1d-r3 -> 1.1.1g-r0)
(4/6) Upgrading ca-certificates-cacert (20191127-r0 -> 20191127-r2)
(5/6) Upgrading ca-certificates (20191127-r0 -> 20191127-r2)
(6/6) Upgrading musl-utils (1.1.24-r0 -> 1.1.24-r2)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 6 MiB in 15 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/15) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(2/15) Installing ncurses-libs (6.1_p20200118-r4)
(3/15) Installing readline (8.0.1-r0)
(4/15) Installing bash (5.0.11-r1)
Executing bash-5.0.11-r1.post-install
(5/15) Installing nghttp2-libs (1.40.0-r1)
(6/15) Installing libcurl (7.67.0-r1)
(7/15) Installing expat (2.2.9-r1)
(8/15) Installing pcre2 (10.34-r1)
(9/15) Installing git (2.24.3-r0)
(10/15) Installing c-ares (1.15.0-r0)
(11/15) Installing libgcc (9.3.0-r0)
(12/15) Installing libstdc++ (9.3.0-r0)
(13/15) Installing libuv (1.34.0-r0)
(14/15) Installing nodejs (12.15.0-r1)
(15/15) Installing npm (12.15.0-r1)
Executing busybox-1.31.1-r9.trigger
OK: 81 MiB in 30 packages
Removing intermediate container fa07a631bfe0
---> a742bf474e1a
Step 3/14 : RUN go get -u github.com/jteeuwen/go-bindata/...
---> Running in 188b7ce143b4
Removing intermediate container 188b7ce143b4
---> 1b29233a664c
Step 4/14 : WORKDIR /go/src/github.com/kubernetes-up-and-running/kuard
---> Running in 2ad45a100f35
Removing intermediate container 2ad45a100f35
---> 6d5ee90210db
Step 5/14 : COPY . .
---> b9fc1ee3a5ba
Step 6/14 : ENV VERBOSE=0
---> Running in f91068a0dfee
Removing intermediate container f91068a0dfee
---> 98e3462203d0
Step 7/14 : ENV PKG=github.com/kubernetes-up-and-running/kuard
---> Running in 7debf3657452
Removing intermediate container 7debf3657452
---> 59ef569e8643
Step 8/14 : ENV ARCH=amd64
---> Running in be7ee25cf910
Removing intermediate container be7ee25cf910
---> 7d21b0894113
Step 9/14 : ENV VERSION=test
---> Running in 32dcbb044af5
Removing intermediate container 32dcbb044af5
---> 3fd749607c94
Step 10/14 : RUN build/build.sh
---> Running in fcc07d1aaf1e
Verbose: 0
buffer.js:585
slice: (buf, start, end) => buf.utf8Slice(start, end),
^

RangeError: Index out of range
at Object.slice (buffer.js:585:37)
at Buffer.toString (buffer.js:782:14)
at Object.readFileSync (fs.js:386:41)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:990:22)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11 {
code: 'ERR_OUT_OF_RANGE'
}
The command '/bin/sh -c build/build.sh' returned a non-zero code: 1

Can't run kuard on raspberry cluster

When I try to run the examples from Chapter 6 and 7 in my raspberry cluster, the pods and services do not start.

>kubectl run alpaca-prod --image=gcr.io/kuar-demo/kuard-amd64:blue --replicas=3 --port=8080 --labels="ver=1,app=alpaca,env=prod"
>kubectl logs alpaca-prod
standard_init_linux.go:211: exec user process caused "exec format error"
>kubectl describe pods alpaca-prod
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  <unknown>          default-scheduler  Successfully assigned default/alpaca-prod to fc3
  Normal   Pulled     29s (x4 over 74s)  kubelet, fc3       Container image "gcr.io/kuar-demo/kuard-amd64:blue" already present on machine
  Normal   Created    28s (x4 over 74s)  kubelet, fc3       Created container alpaca-prod
  Normal   Started    28s (x4 over 73s)  kubelet, fc3       Started container alpaca-prod
  Warning  BackOff    3s (x8 over 71s)   kubelet, fc3       Back-off restarting failed container

Looks like an internal error in the container.

Config steps for Pi Cluster

I'm setting up the Hypriot cluster using the KUARD book example.

I've been able to configure the master node (wifi enabled, serving DHCP) connects to internet no issue. Serves DHCP IPs no issue.

I followed instructions to configure NAT on 3 worker nodes. I'm assuming all requests to external internet are going through the wlan0 interface on the master node.

My issue is, when installing Kubernetes on other 3 nodes, several apt-get updates throw errors resolving certain URLs.

Is there a way to improve performance over NAT. Or...
Is there any drawback to configuring the nodes to go to external internet through wifi (i.e remove NAT configuration)

Documentation: Add socat as a pre-requisite

Hello folks,

Loved the book and have found kuard super useful for testing. I bumped into an issue this morning when I tried to create a port-forward to kuard:

$ kubectl port-forward kuard 8080:8080
Forwarding from 127.0.0.1:8080 -> 8080
Handling connection for 8080
E0203 14:12:54.651409 20574 portforward.go:331] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod febaeb6b4747d87036534845214f391db41cda998a592e541d4b6be7ff615ef4, uid : unable to do port forwarding: socat not found.

I poked around the kubelet code and it looks like it needs it runs the socat binary to port forward connections:

https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockershim/docker_streaming.go

 containerPid := container.State.Pid
    socatPath, lookupErr := exec.LookPath("socat")
    if lookupErr != nil {
            return fmt.Errorf("unable to do port forwarding: socat not found.")
    }

I also grep'ed through the repo files and I don't see any notes about socat being a pre-requisite. Would it be possible to note that each Kubernetes worker needs the socat binary installed in a pre-requisite section (I'll be glad to submit a documentation PR)? If this is documented elsewhere my apologies.

The syntethic workload is not working using command line

I tried to simulate batch workers, using the synthetic workload of generating 4096 bit RSA keys through the command line but I got some error messages.

I can do the same simulation using the UI successfully.

I´m using the following command:

kubectl run -i oneshot --image=gcr.io/kuar-demo/kuard-amd64:blue --restart=OnFailure -- --keygen-enable --keygen-exit-on-complete --keygen-num-to-g
en 10

Here are the events:
Events:
Type Reason Age From Message


Normal Scheduled 96s default-scheduler Successfully assigned default/oneshot to aks-nodepool1-11892983-1
Normal Pulled 7s (x5 over 95s) kubelet, aks-nodepool1-11892983-1 Container image "gcr.io/kuar-demo/kuard-amd64:blue" already present on machine
Normal Created 7s (x5 over 95s) kubelet, aks-nodepool1-11892983-1 Created container oneshot
Warning Failed 6s (x5 over 95s) kubelet, aks-nodepool1-11892983-1 Error: failed to start container "oneshot": Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "--keygen-enable": executable file not found in $PATH: unknown
Warning BackOff 1s (x8 over 93s) kubelet, aks-nodepool1-11892983-1 Back-off restarting failed container

Jobs, chapter 12, with K8s 1.18, 2 breaking changes

Chapter 12 says to start a Job like this:

$ kubectl run -i oneshot \
  --image=gcr.io/kuar-demo/kuard-amd64:blue \
  --restart=OnFailure \
  -- --keygen-enable \
      --keygen-exit-on-complete \
      --keygen-num-to-gen 10

With K8s 1.18, there is a deprecation.

Remove all the generators from kubectl run. It will now only create pods. Additionally, deprecates all the flags that are not relevant anymore. (#87077, @soltysh) [SIG Architecture, SIG CLI, and SIG Testing]

So instead this command creates a Pod instead of a Job. OK, software evolves and printed copies do not. We can deal with this. However, there is another issue. The Pod will fail with:

Error: failed to start container "kuard": Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: "--keygen-enable": executable file not found in $PATH": unknown

Something about "blue" version of Kuard container changed. To work around it one has to change the command to

$ kubectl run -i oneshot \
  --image=gcr.io/kuar-demo/kuard-amd64:blue \
  --restart=OnFailure \
  -- \
      /kuard \
      --keygen-enable \
      --keygen-exit-on-complete \
      --keygen-num-to-gen 10

Notice the addition of /kuard \

@surfer190 also documented their findings in these extensive notes found here. In the document search for "That said the error:" to see the same finding.

The issue is noted and worked around in this Katacoda scenario. I'm the author of this scenario.

This issue is more of an errata note for the Jobs chapter.

permission denied issue

I am following the kubernetes up and running book.
I created the following:

FROM alpine
MAINTAINER Kelsey Hightower [email protected]
COPY bin/kuard /kuard
ENTRYPOINT ["/kuard"]

Ran:
docker build -t kuard-amd64:1 .

then ran this:
docker run -d --name kuard
--publish 8080:8080
gcr.io/kuar-demo/kuard-amd64:1

Error
ubuntu@ip-172-31-17-121:~/kuard$ sudo docker run -d --name kuard --publish 8080:8080 kuard-amd64:1
63d568a095758b5638200f30b964e9a4919f044be9871281658f6a47b18e1202
docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: "/kuard": permission denied".

Gcloud enable container command missing

Hi there,

Just to let y'all know that in Chapter 3 (page 51) it's missing the gcloud services enable container command before the gcloud container clusters create kuar-cluster

Not a big deal, but can save some minutes for the readers.

Thanks,
Allan.

Question about queue Job

Hi, Jbeda

thanks for writing the book and this repo, I have a question after read the Job section, for the queue job that read the task from a mem queue ,and run to complete until all the task dequeued, what if new task added to queue after it finished the task? is it supposed to restart the stopped container to process the new task?

Fix up import paths

We moved from github.com/jbeda/kaurd to github.com/kubernetes-up-and-running/kuard. Need to update code.

Make build fails

When I tried to build kuard as described in the book, the build failed. Details follow, with Go version, OS and Docker information as well as the verbose build output.

jam-xps:kuard jam [master] $ uname -a
Linux jam-xps 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64 x86_64 x86_64 [GNU/Linux]
jam-xps:kuard jam [master] $ go version
go version go1.10.2 linux/amd64
jam-xps:kuard jam [master] $ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     falsejam-xps:kuard jam [master] $ go version
go version go1.10.2 linux/amd64
jam-xps:kuard jam [master] $ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     false
jam-xps:kuard jam [master] $ make build
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.7.2-4-g423174b-dirty-1 -u $(id -u):$(id -g) -v kuard-build-data:/data:delegated -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules:delegated -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard:delegated -v $(pwd)/bin/1/amd64:/data/go/bin:delegated -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64:delegated -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
Verbose: 1
Building with VERBOSE
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.7.2-4-g423174b-dirty-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
+ cd client
+ npm install --loglevel=error
+ npm run build

> [email protected] build /data/go/src/github.com/kubernetes-up-and-running/kuard/client
> NODE_ENV=production webpack

Hash: 2b872c019015d34514a9
Version: webpack 1.15.0
Time: 6657ms
        Asset     Size  Chunks             Chunk Names
    bundle.js   334 kB       0  [emitted]  main
bundle.js.map  2.84 MB       0  [emitted]  main
    + 266 hidden modules
+ go generate -x ./cmd/... ./pkg/...
go-bindata -pkg sitedata -prefix ../../sitedata/ -o bindata.go ../../sitedata/...
+ go install -x -installsuffix static -ldflags '-X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.7.2-4-g423174b-dirty-1' ./cmd/...
WORK=/tmp/go-build776450649
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/sitedata -complete -installsuffix static -buildid c295c07b6aedeef71729c3e740bc61f45c84bf9a -importmap github.com/elazarl/go-bindata-assetfs=github.com/kubernetes-up-and-running/kuard/vendor/github.com/elazarl/go-bindata-assetfs -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/pkg/errors=github.com/kubernetes-up-and-running/kuard/vendor/github.com/pkg/errors -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./bindata.go ./doc.go ./sitedata.go
mkdir -p /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -complete -installsuffix static -buildid d30682a8c304174943c7e53f213621500e16c880 -importmap github.com/dustin/go-humanize=github.com/kubernetes-up-and-running/kuard/vendor/github.com/dustin/go-humanize -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./filters.go ./hashcolor.go ./template.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -complete -installsuffix static -buildid 755c570d28ece81ef1013d684cb1a637a7ba0e45 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./api.go ./config.go ./probe.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/app -complete -installsuffix static -buildid 5af8552b39c0bd865cedc2b6af48cb2e2f580eab -importmap github.com/felixge/httpsnoop=github.com/kubernetes-up-and-running/kuard/vendor/github.com/felixge/httpsnoop -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/prometheus/client_golang/prometheus=github.com/kubernetes-up-and-running/kuard/vendor/github.com/prometheus/client_golang/prometheus -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./app.go ./config.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/app.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a -trimpath $WORK -p main -complete -installsuffix static -buildid de7e116e279e7862043ed01c2d0636c476341b96 -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./main.go
cd .
/usr/local/go/pkg/tool/linux_amd64/link -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out -L $WORK -L /data/go/pkg/linux_amd64_static -installsuffix static -extld=gcc -buildmode=exe -buildid=de7e116e279e7862043ed01c2d0636c476341b96 -X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.7.2-4-g423174b-dirty-1 $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a
mkdir -p /data/go/bin/
cp $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out /data/go/bin/kuard
go install github.com/kubernetes-up-and-running/kuard/cmd/kuard: open /data/go/bin/kuard: permission denied
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

Documentation Update

Hello, first thanks for this useful project

I think is important to update or mention in the documentation that a newer version may be available

The run command is:

kubectl run --restart=Never --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl port-forward kuard 8080:8080

But it seems that new versions are available eg. gcr.io/kuar-demo/kuard-amd64:3

I can do a PR to improve this 😄

What do you think?

Chapter 2: Remote Registry

Was able to work through the original issues with the chapter and the Kuard demo. I'm almost to the end and I'm having a problem pushing the kuard image.

patricks-mbp:k8s patrick$ docker login
Authenticating with existing credentials...
Login Succeeded
patricks-mbp:k8s patrick$ docker tag kuard gcr.io/kuar-demo/kuard-amd64:blue
patricks-mbp:k8s patrick$ docker push gcr.io/kuar-demo/kuard-amd64:blue
The push refers to repository [gcr.io/kuar-demo/kuard-amd64]
394b19c55b51: Preparing
f70fb0293b4c: Preparing
92ef4a709b7b: Preparing
ab0ec28f3a15: Preparing
9d98c080a30a: Preparing
101937cc95b4: Waiting
7bff3ff75b7b: Waiting
5aea01ea0a0f: Waiting
05f4935ad90a: Waiting
c96f2308ab16: Waiting
38c2f9ead82d: Waiting
0dabcc98eeef: Waiting
6885f9305c0a: Waiting
unauthorized: Unauthorized access.

I'm definitely a noob and was hoping this book would be step-by-step. Any help would be greatly appreciated.

Corrections/updates to 3rd edition, chapter 6, Labels

The section of chapter 6 titled "Applying Labels" would have the reader run commands like this to create and label some deployments:

$ kubectl run alpaca-prod \
  --image=gcr.io/kuar-demo/kuard-amd64:blue \
  --replicas=2 \
  --labels="ver=1,app=alpaca,env=prod"

A user running any recent version of kubectl will find this command does not work. As of March 2020, Kubernetes v1.18 changed the run command to create pods instead of deployments. You might then try kubectl create deployment and find the command does not take a --labels option.

The commands I've found to work instead take the form:

# First, create the deployment
$ kubectl create deployment alpaca-prod --image=gcr.io/kuar-demo/kuard-amd64:blue --replicas=2
# After the deployment is created, you can add some labels
$ kubectl label deployments alpaca-prod --overwrite ver=1 app=alpaca env=prod

Note that kubectl create deployment alpaca-prod ... automatically added a label app=alpaca-prod to the deployment. That's why we need the --overwrite option there.

Also note, in the next section, "Label Selectors", where the book would have you select the pods in the deployment by the labels you just applied to the deployment, pods do not inherit labels applied to the deployments this way. You will see this when you run kubectl get pods. The pods have the default app labels with values "alpaca-prod", "bandicoot-staging", etc, and also a pod-template-hash label, but not the labels you applied to the deployments.

I assume this statement from the "Label Selectors" section...

Each deployment (via a ReplicaSet) creates a set of Pods using the labels specified in the template embedded in the deployment. This is configured by the kubectl run command.

is not longer true of how the Kubernetes API works. Or maybe in creating deployments another way, such as by applying a YAML manifest, there is a way to have the pods inherit the labels of the deployment. Maybe that's where the ReplicaSet is involved. The book hasn't covered ReplicaSets by chapter 6.

Hopefully this will be helpful to anyone else who gets stuck on chapter 6. And hopefully the changed API makes it into the next edition of the book.

Provide ARM build

Hello,
I am following the book with (kind-of) RPi cluster. However, this demo seems not to be available for arm:

tomas@arkham:~$ docker pull gcr.io/kuar-demo/kuard-amd64:1
1: Pulling from kuar-demo/kuard-amd64
ec37562cf8fa: Pull complete 
f50fc4297ee3: Pull complete 
Digest: sha256:a5805d4728b3017ee910e914a129e1901e68d7c9867743ff1f345eb8a1b5c41f
Status: Downloaded newer image for gcr.io/kuar-demo/kuard-amd64:1
tomas@arkham:~$ docker pull gcr.io/kuar-demo/kuard-arm:1
Error response from daemon: manifest for gcr.io/kuar-demo/kuard-arm:1 not found

Could you perhaps build this for arm as well and add it to the registry?

Thanks a lot,
Tomas

Issue setting up Pi cluster

Hello,
i am following the german verison of the Book kubernetes-up-and-running. After several days of frustrating work I finally got all my Pi s up and kubernetes installed on all of them. Since later versions don´t work or have a different setup than described, I use the hypriotOS v1.6.0.

I am stuc at setting up the cluster. In the german book it says to type in the following command:

$kubeadm init --pod-network-cidr 10.244.0.0/16 --api-advertise-addresses 10.0.0.1

I already figured that the corrct line should be:

$kubeadm init --pod-network-cidr 10.244.0.0/16 --apiserver-advertise-address 10.0.0.1

but executing this leds me to beeing stuck
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests" [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory"/etc/kubernetes/manifests". This can take up to 4m0s [kubelet-check] Initial timeout of 40s passed. Unfortunately, an error has occurred: timed out waiting for the condition ...

Full Output attached.

Output.txt

Does anyone know how to fix this?

Include curl in kuard Docker image

Please have curl installed in kuard Docker image so that the image can be used for testing Istio with mutual TLS enabled and liveness/readiness probes defined for kuard deployment.

Because of a bug in Istio, when mutual TLS is enabled, httpGet as liveness/readiness probe does not work and using exec/command+curl is a workaround (see istio/istio#1194 (comment)).

kubectl create -f 5-1-kuard-pod.yaml

Trying to execute kubectl create -f 5-1-kuard-pod.yaml

Error on minikube

error: error validating "5-1-kuard-pod.yaml": error validating data: ValidationError(Pod.metadata): unknown field "spec" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false`

Error on kubeadm

error: error validating "5-1-kuard-pod.yaml": error validating data: ValidationError(Pod.metadata): unknown field "spec" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false

kubectl version

Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:27:35Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-10-06T20:53:14Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

i am unable to pull the image

Hi,
I am following this book and unable to create the image from dockerfile (chapter2 ) and also while pulling the image i am getting the "unknown authority". please help me to download this image

[root@minion1 ~]# docker pull gcr.io/kuar-demo/kuard-amd64:1
Trying to pull repository gcr.io/kuar-demo/kuard-amd64 ...
1: Pulling from gcr.io/kuar-demo/kuard-amd64

2fdfe1cd78c2: Pulling fs layer
fd39a7f0b8e8: Pulling fs layer
error pulling image configuration: Get https://storage.googleapis.com/artifacts.kuar-demo.appspot.com/containers/images/sha256:a92da648d493e06a2b4e63cb478c77b355800044054e262c561e65f343e959c8: x509: certificate signed by unknown authority

Regards,
-Hari

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.