k3d-io / k3d-demo Goto Github PK
View Code? Open in Web Editor NEWDemo of k3d: Tool to run k3s (Kubernetes) in Docker
Home Page: https://k3d.io/
License: MIT License
Demo of k3d: Tool to run k3s (Kubernetes) in Docker
Home Page: https://k3d.io/
License: MIT License
Quick reminder from the great demo:
3 servers spin up
The number of servers is not reflected: https://github.com/iwilltry42/k3d-demo/blob/main/assets/k3d-config.yaml#L4
Only 1 server spins up
Hello, I was following the YouTube demo of beta release of k3d, but I am not able to get the beta version after using wget command.
root@testserver:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
root@ testserver:~# wget -q -O - https://raw.githubusercontent.com/rancher/k3d/master/install.sh | TAG=v3.0.0-beta.1 bash
Preparing to install k3d into /usr/local/bin
k3d installed into /usr/local/bin/k3d
Run 'k3d --help' to see what you can do with it.
root@ testserver:~# k3d version
k3d version v1.7.0
k3s version v1.17.3-k3s1
On a Macbook pro-2019 (Intel i9), while following steps in the demo, the Helm deployment step fails with the following error:
# Step: Deploy the sample app with helm
# Command: helm upgrade --install sample-app sample/conf/charts/sample-app --namespace demo --set app.image=sample-app:local [Enter]
$ helm upgrade --install sample-app sample/conf/charts/sample-app --namespace demo --set app.image=sample-app:local
Release "sample-app" does not exist. Installing it now.
Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Ingress" in version "networking.k8s.io/v1"
Note:
Walking through the make demo
scenario, when I get to the step kubectl get nodes
I'm getting the following error:
Error from server (InternalError): an error on the server ("") has prevented the request from succeeding
OS: Fedora 32
Docker: Docker version 19.03.8, build afacb8b7f0
k3d: k3d version v3.0.0-beta.1
kubectl: Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
I can't figure out what I'm missing...
Error:
ERROR:
<builtin>: in helm
Error: command ["helm" "template" "/home/rus/k8s/k3d-demo/sample/conf/charts/sample-app" "--name" "chart" "--set" "app.srcFrom=null"] failed.
error: exit status 1
stdout: ""
stderr: "Error: apiVersion 'v2' is not valid. The value must be \"v1\"\n"
apiVersion v2 can't be rendered in Helm v2
diff --git a/sample/conf/charts/sample-app/Chart.yaml b/sample/conf/charts/sample-app/Chart.yaml
index 3053ef6..927e6ba 100644
--- a/sample/conf/charts/sample-app/Chart.yaml
+++ b/sample/conf/charts/sample-app/Chart.yaml
@@ -1,4 +1,4 @@
-apiVersion: v2
+apiVersion: v1
name: sample-app
description: Helm Chart to deploy a ample-app
type: application
Hi, I got this error when trying out make demo
. It occurred when I canceled make demo
once to install helm (during the prompt for Step: Deploy the sample app with helm
), then ran it again.
# ***** Section: Grow the Cluster *****
# Step: Add 2 agents to the cluster
# Command: k3d node create new-agent --cluster demo --role agent --replicas 2 [Enter]
$ k3d node create new-agent --cluster demo --role agent --replicas 2
INFO[0000] Adding 2 node(s) to the runtime local cluster 'demo'...
fatal error: concurrent map iteration and map write
goroutine 29 [running]:
github.com/k3d-io/k3d/v5/pkg/runtimes/docker.getNodeContainer({0xff2708, 0xc0000a8140}, 0xc0001c2000)
/home/runner/work/k3d/k3d/pkg/runtimes/docker/container.go:140 +0x2fe
github.com/k3d-io/k3d/v5/pkg/runtimes/docker.Docker.ReadFromNode({}, {0xff2708, 0xc0000a8140}, {0xe8cb4c, 0x16}, 0xc0001c2000)
/home/runner/work/k3d/k3d/pkg/runtimes/docker/util.go:160 +0x134
github.com/k3d-io/k3d/v5/pkg/client.GetLoadbalancerConfig({0xff2708, 0xc0000a8140}, {0x1001ef0?, 0x1636680?}, 0xc000610300)
/home/runner/work/k3d/k3d/pkg/client/loadbalancer.go:129 +0x336
github.com/k3d-io/k3d/v5/pkg/client.ClusterGet({0xff2708, 0xc0000a8140}, {0x1001ef0, 0x1636680}, 0xc000610300)
/home/runner/work/k3d/k3d/pkg/client/cluster.go:837 +0x7d4
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToCluster({0xff2708, 0xc0000a8140}, {0x1001ef0?, 0x1636680?}, 0xc000502d00, 0xc000610300?, {0x1, 0x0, {0x0, 0x0, ...}, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:61 +0x9a
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToClusterMulti.func1()
/home/runner/work/k3d/k3d/pkg/client/node.go:338 +0x57
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:72 +0xa5
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc000011068?)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/sema.go:62 +0x27
sync.(*WaitGroup).Wait(0xe155a0?)
/opt/hostedtoolcache/go/1.20.7/x64/src/sync/waitgroup.go:116 +0x4b
golang.org/x/sync/errgroup.(*Group).Wait(0xc0006225c0)
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:53 +0x27
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToClusterMulti({0xff2740, 0xc0000380f8}, {0x1001ef0?, 0x1636680}, {0xc000609140, 0x2, 0x0?}, 0xc000610300, {0x1, 0x0, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:341 +0x2ac
github.com/k3d-io/k3d/v5/cmd/node.NewCmdNodeCreate.func1(0xc0000e1500, {0xc0003d24d0?, 0x7?, 0x7?})
/home/runner/work/k3d/k3d/cmd/node/nodeCreate.go:58 +0x3ff
github.com/spf13/cobra.(*Command).execute(0xc0000e1500, {0xc0003d2460, 0x7, 0x7})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004600)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/k3d-io/k3d/v5/cmd.Execute()
/home/runner/work/k3d/k3d/cmd/root.go:148 +0x176
main.main()
/home/runner/work/k3d/k3d/main.go:27 +0x17
goroutine 30 [runnable]:
reflect.name.name({0xcd1d39?})
/opt/hostedtoolcache/go/1.20.7/x64/src/reflect/type.go:527 +0xbf
reflect.(*structType).Field(0xdb5da0, 0x0)
/opt/hostedtoolcache/go/1.20.7/x64/src/reflect/type.go:1262 +0x9f
reflect.(*rtype).Field(0xffffffffffffffff?, 0x16?)
/opt/hostedtoolcache/go/1.20.7/x64/src/reflect/type.go:987 +0x6b
github.com/imdario/mergo.hasMergeableFields({0xdb5da0?, 0xc0006220d0?, 0xcc006842dd0?})
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:18 +0xee
github.com/imdario/mergo.deepMerge({0xdb5da0?, 0xc0006220d0?, 0xcc006842cc0?}, {0xdb5da0?, 0xc0001cc310?, 0x17?}, 0x3?, 0x5, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:91 +0xfed
github.com/imdario/mergo.deepMerge({0xdb5e40?, 0xc0006220c0?, 0xcc006842cc0?}, {0xdb5e40?, 0xc0001cc300?, 0xd58120?}, 0x0?, 0x4, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:93 +0x119e
github.com/imdario/mergo.deepMerge({0xdb95e0?, 0xc0006220c0?, 0xcc001de3298?}, {0xdb95e0?, 0xc0001cc300?, 0x18?}, 0x0?, 0x3, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:93 +0x119e
github.com/imdario/mergo.deepMerge({0xd06860?, 0xc0001c2118?, 0xcc001de3210?}, {0xd06860?, 0xc000502458?, 0x98?}, 0xd2e9a0?, 0x2, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:261 +0x7db
github.com/imdario/mergo.deepMerge({0xdb9ae0?, 0xc0001c2110?, 0xcc001de2000?}, {0xdb9ae0?, 0xc000502450?, 0xd2e9a0?}, 0xfe77f0?, 0x1, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:93 +0x119e
github.com/imdario/mergo.deepMerge({0xe61d60?, 0xc0001c2000?, 0xd596e0?}, {0xe61d60?, 0xc000502340?, 0xc0000c6f00?}, 0xc000281600?, 0x0, 0xc0004133b0)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:93 +0x119e
github.com/imdario/mergo.merge({0xd596e0, 0xc0001c2000}, {0xd596e0, 0xc000502340}, {0xc0004161d8, 0x1, 0x0?})
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:376 +0x32b
github.com/imdario/mergo.MergeWithOverwrite(...)
/home/runner/go/pkg/mod/github.com/imdario/[email protected]/merge.go:313
github.com/k3d-io/k3d/v5/pkg/client.ClusterGet({0xff2708, 0xc0000a8140}, {0x1001ef0, 0x1636680}, 0xc000610300)
/home/runner/work/k3d/k3d/pkg/client/cluster.go:815 +0x9fc
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToCluster({0xff2708, 0xc0000a8140}, {0x1001ef0?, 0x1636680?}, 0xc000502ea0, 0xc000610300?, {0x1, 0x0, {0x0, 0x0, ...}, ...})
/home/runner/work/k3d/k3d/pkg/client/node.go:61 +0x9a
github.com/k3d-io/k3d/v5/pkg/client.NodeAddToClusterMulti.func1()
/home/runner/work/k3d/k3d/pkg/client/node.go:338 +0x57
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:72 +0xa5
goroutine 72 [IO wait]:
internal/poll.runtime_pollWait(0x7f1b17a71c18, 0x72)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0004f8680?, 0xc000132000?, 0x0)
/opt/hostedtoolcache/go/1.20.7/x64/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
/opt/hostedtoolcache/go/1.20.7/x64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0004f8680, {0xc000132000, 0x1000, 0x1000})
/opt/hostedtoolcache/go/1.20.7/x64/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0004f8680, {0xc000132000?, 0x2?, 0xc000432b40?})
/opt/hostedtoolcache/go/1.20.7/x64/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000012130, {0xc000132000?, 0x0?, 0x0?})
/opt/hostedtoolcache/go/1.20.7/x64/src/net/net.go:183 +0x45
net/http.(*persistConn).Read(0xc00064eea0, {0xc000132000?, 0x44b580?, 0xc0001e0ec8?})
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:1943 +0x4e
bufio.(*Reader).fill(0xc0004f6c00)
/opt/hostedtoolcache/go/1.20.7/x64/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc0004f6c00, 0x1)
/opt/hostedtoolcache/go/1.20.7/x64/src/bufio/bufio.go:144 +0x5d
net/http.(*persistConn).readLoop(0xc00064eea0)
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:2107 +0x1ac
created by net/http.(*Transport).dialConn
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:1765 +0x16ea
goroutine 54 [runnable]:
sync.runtime_SemacquireMutex(0xc00018b000?, 0xe0?, 0xc0001ddd30?)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/sema.go:77 +0x26
sync.(*Mutex).lockSlow(0xc0002452d8)
/opt/hostedtoolcache/go/1.20.7/x64/src/sync/mutex.go:171 +0x165
sync.(*Mutex).Lock(...)
/opt/hostedtoolcache/go/1.20.7/x64/src/sync/mutex.go:90
net/http.(*persistConn).readLoop(0xc000245200)
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:2109 +0x1f0
created by net/http.(*Transport).dialConn
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:1765 +0x16ea
goroutine 73 [select]:
net/http.(*persistConn).writeLoop(0xc00064eea0)
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:2410 +0xf2
created by net/http.(*Transport).dialConn
/opt/hostedtoolcache/go/1.20.7/x64/src/net/http/transport.go:1766 +0x173d
@iwilltry42 this repo is a very useful k3d demo, with many tips packed.
Thanks for sharing it !
It works flawlessly on my ubuntu 20.04 machine.
However I noticed that on a Centos7 VM the load balancer does not work.
make demo
and stop after the first stage (cluster creation) on Ubuntu I get:> curl localhost:8080
404 page not found
> curl localhost:8080
Empty reply from server
The following steps do not change this output.
Inspecting container k3d-demo-serverlb
logs and processes I could not pinpoint the problem.
At least pinging from one container to another using theirs name works:
#### inside k3d-demo-server-0
/ # ping k3d-demo-agent-0
PING k3d-demo-agent-0 (172.19.0.4): 56 data bytes
64 bytes from 172.19.0.4: seq=0 ttl=64 time=0.077 ms
64 bytes from 172.19.0.4: seq=1 ttl=64 time=0.080 ms
I wonder if this is a tiny config glitch, or some serious low level limitation...
What do you think ?
The make prep
command will delete containers / images / volumes, such destructive command should require user READ instructions and DOUBLE even TRIPLE confirm.
Using the
$ make demo
or
./scripts/lifecycle.sh
Will generate a command like this on Windows in GitBash;
There doesn't appear to be a great work around but simply omitting the --volume seems to work, I guess then you would need to copy files manually to the docker images?
i.e. k3d cluster create demo --api-port 6550 --servers 1 --agents 3 --port 8080:80@loadbalancer --wait
The problem is that the paths do get converted to windows paths and the C:\Users confuses something :) Please advise.
After seeing a few Drone CI runs spin and then fail after an hour, I added a basic sanity check on the value of $DRONE_BUILD_STARTED (i.e. - echo sanity - $${DRONE_BUILD_STARTED}
)
In one run,
k3dsvc: sanity - 1669820814
test: sanity - 1669820815
While the k3d service is healthy, and the kubeconfig is in place, the "test" step is looking for the wrong filename indefinitely.
Suggested resolution: as these are ephemeral environments, we can use a hard-coded filename (e.g. kubeconfig.yaml).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.