diff --git a/.github/workflows/assets/1.yaml b/.github/workflows/assets/1.yaml index 5975435..dc8d242 100644 --- a/.github/workflows/assets/1.yaml +++ b/.github/workflows/assets/1.yaml @@ -1,4 +1,4 @@ -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple image: docker.io/rancher/k3s:v1.21.2-k3s1 servers: 1 @@ -6,23 +6,23 @@ agents: 3 ports: - port: 0.0.0.0:80:80 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:443:443 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:5053:53/udp nodeFilters: - - agent[0] + - agent:0:direct options: k3d: wait: true - timeout: "60s" + timeout: 1m0s disableLoadbalancer: true - disableImageVolume: true k3s: - extraServerArgs: - - --no-deploy=traefik,servicelb,metrics-server - extraAgentArgs: [] + extraArgs: + - arg: --no-deploy=traefik,servicelb,metrics-server + nodeFilters: + - server:* kubeconfig: updateDefaultKubeconfig: true switchCurrentContext: true diff --git a/.github/workflows/assets/2.yaml b/.github/workflows/assets/2.yaml index e0d8252..f0d965c 100644 --- a/.github/workflows/assets/2.yaml +++ b/.github/workflows/assets/2.yaml @@ -1,4 +1,4 @@ -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple image: docker.io/rancher/k3s:v1.21.2-k3s1 servers: 1 @@ -6,23 +6,23 @@ agents: 3 ports: - port: 0.0.0.0:81:80 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:444:443 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:5054:53/udp nodeFilters: - - agent[0] + - agent:0:direct options: k3d: wait: true - timeout: "60s" + timeout: 1m0s disableLoadbalancer: true - disableImageVolume: true k3s: - extraServerArgs: - - --no-deploy=traefik,servicelb,metrics-server - extraAgentArgs: [] + extraArgs: + - arg: --no-deploy=traefik,servicelb,metrics-server + nodeFilters: + - server:* kubeconfig: updateDefaultKubeconfig: true switchCurrentContext: true diff --git a/.github/workflows/assets/3.yaml b/.github/workflows/assets/3.yaml index 63d7ac7..21ae839 100644 --- a/.github/workflows/assets/3.yaml +++ b/.github/workflows/assets/3.yaml @@ -1,4 +1,4 @@ -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple image: docker.io/rancher/k3s:v1.21.2-k3s1 servers: 1 @@ -6,23 +6,23 @@ agents: 3 ports: - port: 0.0.0.0:82:80 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:445:443 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:5055:53/udp nodeFilters: - - agent[0] + - agent:0:direct options: k3d: wait: true - timeout: "60s" + timeout: 1m0s disableLoadbalancer: true - disableImageVolume: true k3s: - extraServerArgs: - - --no-deploy=traefik,servicelb,metrics-server - extraAgentArgs: [] + extraArgs: + - arg: --no-deploy=traefik,servicelb,metrics-server + nodeFilters: + - server:* kubeconfig: updateDefaultKubeconfig: true switchCurrentContext: true diff --git a/.github/workflows/assets/4.yaml b/.github/workflows/assets/4.yaml index 5c9e828..fede935 100644 --- a/.github/workflows/assets/4.yaml +++ b/.github/workflows/assets/4.yaml @@ -1,4 +1,4 @@ -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple # image: default k3s version servers: 1 @@ -6,23 +6,23 @@ agents: 3 ports: - port: 0.0.0.0:83:80 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:446:443 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:5056:53/udp nodeFilters: - - agent[0] + - agent:0:direct options: k3d: wait: true - timeout: "60s" + timeout: 1m0s disableLoadbalancer: true - disableImageVolume: true k3s: - extraServerArgs: - - --no-deploy=traefik,servicelb,metrics-server - extraAgentArgs: [] + extraArgs: + - arg: --no-deploy=traefik,servicelb,metrics-server + nodeFilters: + - server:* kubeconfig: updateDefaultKubeconfig: true switchCurrentContext: true diff --git a/.github/workflows/assets/default.yaml b/.github/workflows/assets/default.yaml index df3a784..08ae7d0 100644 --- a/.github/workflows/assets/default.yaml +++ b/.github/workflows/assets/default.yaml @@ -1,17 +1,13 @@ -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple name: k3s-k8gb-disco2 servers: 1 agents: 1 kubeAPI: - hostIP: "0.0.0.0" + hostIP: 0.0.0.0 hostPort: "6443" -image: rancher/k3s:latest +image: docker.io/rancher/k3s:latest network: nw03 -labels: - - label: foo=bar - nodeFilters: - - loadbalancer ports: - port: 0.0.0.0:8443:443 nodeFilters: @@ -26,13 +22,18 @@ env: options: k3d: wait: true - timeout: "60s" + timeout: 1m0s disableLoadbalancer: false - disableImageVolume: true k3s: - extraServerArgs: - - --no-deploy=metrics-server - extraAgentArgs: [] + extraArgs: + - arg: --no-deploy=metrics-server + nodeFilters: + - server:* kubeconfig: updateDefaultKubeconfig: true switchCurrentContext: true + runtime: + labels: + - label: foo=bar + nodeFilters: + - loadbalancer diff --git a/.github/workflows/multi-cluster-on-isolated-networks.yaml b/.github/workflows/multi-cluster-on-isolated-networks.yaml index f74af91..74c370a 100644 --- a/.github/workflows/multi-cluster-on-isolated-networks.yaml +++ b/.github/workflows/multi-cluster-on-isolated-networks.yaml @@ -16,12 +16,12 @@ jobs: network: "nw01" subnet-CIDR: "172.20.0.0/24" args: >- - -p "80:80@agent[0]" - -p "443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "80:80@agent:0:direct" + -p "443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2 @@ -31,12 +31,12 @@ jobs: network: "nw02" subnet-CIDR: "172.20.1.0/24" args: >- - -p "81:80@agent[0]" - -p "444:443@agent[0]" - -p "5054:53/udp@agent[0]" + -p "81:80@agent:0:direct" + -p "444:443@agent:0:direct" + -p "5054:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | diff --git a/.github/workflows/multi-cluster-registry.yaml b/.github/workflows/multi-cluster-registry.yaml index b61ab89..0a96f79 100644 --- a/.github/workflows/multi-cluster-registry.yaml +++ b/.github/workflows/multi-cluster-registry.yaml @@ -17,7 +17,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2 name: "Create 2nd k3d Cluster with Registry" @@ -27,7 +27,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | diff --git a/.github/workflows/multi-cluster-two-piars-registry-shared.yaml b/.github/workflows/multi-cluster-two-piars-registry-shared.yaml index 670ec6f..1bee369 100644 --- a/.github/workflows/multi-cluster-two-piars-registry-shared.yaml +++ b/.github/workflows/multi-cluster-two-piars-registry-shared.yaml @@ -19,7 +19,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-1-b @@ -30,7 +30,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-a @@ -42,7 +42,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-b @@ -53,7 +53,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | diff --git a/.github/workflows/multi-cluster-two-piars-registry.yaml b/.github/workflows/multi-cluster-two-piars-registry.yaml index 5ff01e4..6566d2c 100644 --- a/.github/workflows/multi-cluster-two-piars-registry.yaml +++ b/.github/workflows/multi-cluster-two-piars-registry.yaml @@ -21,7 +21,7 @@ jobs: --agents 1 --no-lb --image docker.io/rancher/k3s:v1.21.2-k3s1 - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-1-b @@ -35,7 +35,7 @@ jobs: --agents 1 --no-lb --image docker.io/rancher/k3s:v1.21.2-k3s1 - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-a @@ -50,7 +50,7 @@ jobs: --agents 1 --no-lb --image docker.io/rancher/k3s:v1.21.2-k3s1 - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-b @@ -64,7 +64,7 @@ jobs: --agents 1 --no-lb --image docker.io/rancher/k3s:v1.21.2-k3s1 - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | @@ -101,4 +101,3 @@ jobs: env: REGISTRY_PORT: 5001 run: ./run.sh test-registry - diff --git a/.github/workflows/multi-cluster-two-piars.yaml b/.github/workflows/multi-cluster-two-piars.yaml index 94f730e..1a75400 100644 --- a/.github/workflows/multi-cluster-two-piars.yaml +++ b/.github/workflows/multi-cluster-two-piars.yaml @@ -18,7 +18,7 @@ jobs: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-1-b @@ -29,7 +29,7 @@ jobs: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-a @@ -41,7 +41,7 @@ jobs: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2-b @@ -52,7 +52,7 @@ jobs: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | diff --git a/.github/workflows/multi-cluster.yaml b/.github/workflows/multi-cluster.yaml index 1866d37..fafa980 100644 --- a/.github/workflows/multi-cluster.yaml +++ b/.github/workflows/multi-cluster.yaml @@ -14,24 +14,24 @@ jobs: with: cluster-name: "test-cluster-1" args: >- - -p "80:80@agent[0]" - -p "443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "80:80@agent:0:direct" + -p "443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - uses: ./ id: test-cluster-2 name: "Create 2nd k3d Cluster" with: cluster-name: "test-cluster-2" args: >- - -p "81:80@agent[0]" - -p "444:443@agent[0]" - -p "5054:53/udp@agent[0]" + -p "81:80@agent:0:direct" + -p "444:443@agent:0:direct" + -p "5054:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | diff --git a/.github/workflows/single-cluster-import-registry.yaml b/.github/workflows/single-cluster-import-registry.yaml index 103d3c0..69781c5 100644 --- a/.github/workflows/single-cluster-import-registry.yaml +++ b/.github/workflows/single-cluster-import-registry.yaml @@ -16,7 +16,7 @@ jobs: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: "Docker repo demo" run: | docker build .github/workflows/assets/. -t myproj/demo:v1.0.0 @@ -34,5 +34,3 @@ jobs: kubectl get nodes -o wide - name: Network run: docker network inspect k3d-action-bridge-network - - diff --git a/.github/workflows/single-cluster-node-list.yaml b/.github/workflows/single-cluster-node-list.yaml index ec0ccd9..6883e40 100644 --- a/.github/workflows/single-cluster-node-list.yaml +++ b/.github/workflows/single-cluster-node-list.yaml @@ -14,5 +14,5 @@ jobs: cluster-name: "node-list" args: >- --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - run: kubectl get nodes diff --git a/.github/workflows/single-cluster-registry.yaml b/.github/workflows/single-cluster-registry.yaml index 3d391f3..151741f 100644 --- a/.github/workflows/single-cluster-registry.yaml +++ b/.github/workflows/single-cluster-registry.yaml @@ -18,7 +18,7 @@ jobs: args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | echo ${{ steps.single-cluster.outputs.network }} ${{ steps.single-cluster.outputs.subnet-CIDR }} @@ -35,4 +35,3 @@ jobs: env: REGISTRY_PORT: 5001 run: ./run.sh test-registry - diff --git a/.github/workflows/single-cluster.yaml b/.github/workflows/single-cluster.yaml index 94b1174..b344546 100644 --- a/.github/workflows/single-cluster.yaml +++ b/.github/workflows/single-cluster.yaml @@ -14,12 +14,12 @@ jobs: with: cluster-name: "test-cluster-1" args: >- - -p "80:80@agent[0]" - -p "443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "80:80@agent:0:direct" + -p "443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | echo ${{ steps.single-cluster.outputs.network }} ${{ steps.single-cluster.outputs.subnet-CIDR }} diff --git a/README.md b/README.md index 0606987..b887dec 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,15 @@ a private image registry and multi-cluster support. - [Introduction](#introduction) - [Getting started](#getting-started) + - [Inputs](#inputs) + - [Outputs](#outputs) + - [Version mapping](#version-mapping) - [Single Cluster](#single-cluster) + - [Config file support](#config-file-support) - [Multi Cluster](#multi-cluster) - - [Multi Clusters on default network](#multi-cluster-on-default-network) - - [Multi Cluster on isolated networks](#multi-cluster-on-isolated-networks) - - [Two pairs of clusters on two isolated networks](#two-pairs-of-clusters-on-two-isolated-networks) + - [Multi Cluster on default network](#multi-cluster-on-default-network) + - [Multi Cluster on isolated networks](#multi-cluster-on-isolated-networks) + - [Two pairs of clusters on two isolated networks](#two-pairs-of-clusters-on-two-isolated-networks) - [Private Registry](#private-registry) ## Introduction @@ -63,8 +67,9 @@ Output attributes are accessible via `id`, e.g.: For more details see: [Multi Cluster on isolated networks](#multi-cluster-on-isolated-networks) ### Version mapping -Implementation of additional features brings complexity and sometimes may happen that extra feature is broken in special cases. -To prevent potential issues due to usage such versions, the k3d version is predefined. + +Implementation of additional features brings complexity and sometimes it may happen that extra feature is broken in special cases. +To prevent potential issues, the `k3d` version is fixed according to the mapping below: | k3d-action | k3d | k3s | |:----------:|:-------:|:-----------------------:| @@ -73,9 +78,10 @@ To prevent potential issues due to usage such versions, the k3d version is prede | v1.3.0 | [v4.2.0](https://github.com/rancher/k3d/releases/tag/v4.2.0) | [rancher/k3s:v1.20.4-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.20.4%2Bk3s1)| | v1.4.0 | [v4.4.1](https://github.com/rancher/k3d/releases/tag/v4.4.1) | [rancher/k3s:v1.20.8-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.20.8%2Bk3s1) or [set image explicitly](https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated)| | v1.5.0 | [v4.4.7](https://github.com/rancher/k3d/releases/tag/v4.4.7) | [rancher/k3s:v1.21.2-k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.21.2%2Bk3s1) or [set image explicitly](https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated)| +| v1.6.0 | [v5.1.0](https://github.com/rancher/k3d/releases/tag/v5.1.0) | [rancher/k3s:v1.22.3+k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.22.3%2Bk3s1) or [set image explicitly](https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated)| -From `v1.4.0` would k3d-action users set k3s version explicitly via [configuration](#config-file-support) or -argument e.g.`--image docker.io/rancher/k3s:v1.20.4-k3s1` otherwise k3d specifies which version will be used. +Starting from `k3d-action` `v1.4.0` users can explicitly set [`k3s` image version](https://hub.docker.com/r/rancher/k3s/tags?page=1&ordering=last_updated) via [configuration](#config-file-support) or +argument e.g.`--image docker.io/rancher/k3s:v1.20.4-k3s1` otherwise k3d uses default version accordng to the mapping above. For further k3s details see: - docker [rancher/k3s](https://hub.docker.com/r/rancher/k3s/tags?page=2&ordering=last_updated) @@ -85,7 +91,7 @@ For further k3s details see: Although AbsaOSS/k3d-action strongly supports multi-cluster. Single cluster scenarios are very popular. The minimum single-cluster configuration looks like this : ```yaml - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create Single Cluster" with: cluster-name: "test-cluster-1" @@ -95,18 +101,18 @@ k3d creates a cluster with one worker node (with [traefik](https://traefik.io/) default load-balancer node. In real scenarios you might prefer to do some port mapping and disable default load balancer. Such an action would look like this: ```yaml - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create Single Cluster" with: cluster-name: "test-cluster-1" args: >- - -p "8083:80@agent[0]" - -p "8443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "8083:80@agent:0:direct" + -p "8443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb --image docker.io/rancher/k3s:v1.20.4-k3s1 - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" ``` The created cluster exposes two TCP (`:8083`,`:8443`) and one UDP (`:5053`) ports. The cluster comprises one server, three agents and no load balancers. [k3s-server-argument](https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/#k3s-server-cli-help) @@ -132,7 +138,7 @@ All you need to do is to place configuration file somewhere into your project. H arguments will always take precedence over configuration, so the previous example will result in only one agent, not three as configured. ```yaml -apiVersion: k3d.io/v1alpha2 +apiVersion: k3d.io/v1alpha3 kind: Simple image: docker.io/rancher/k3s:v1.20.5-k3s1 servers: 1 @@ -140,19 +146,18 @@ agents: 3 # The action will overwrite this by 1 ports: - port: 0.0.0.0:80:80 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:443:443 nodeFilters: - - agent[0] + - agent:0:direct - port: 0.0.0.0:5053:53/udp nodeFilters: - - agent[0] + - agent:0:direct options: k3d: wait: true timeout: "60s" disableLoadbalancer: true - disableImageVolume: true k3s: extraServerArgs: - --no-deploy=traefik,servicelb,metrics-server @@ -172,28 +177,28 @@ manually. ### Multi Cluster on default network ```yaml - uses: actions/checkout@v2 - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 1st Cluster" with: cluster-name: "test-cluster-1" args: >- - -p "80:80@agent[0]" - -p "443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "80:80@agent:0:direct" + -p "443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" - - uses: AbsaOSS/k3d-action@v1.5.0 + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 2nd Cluster" with: cluster-name: "test-cluster-2" args: >- - -p "81:80@agent[0]" - -p "444:443@agent[0]" - -p "5054:53/udp@agent[0]" + -p "81:80@agent:0:direct" + -p "444:443@agent:0:direct" + -p "5054:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" ``` Both clusters comprise one server node and three agents nodes. Because of port collision, each cluster must expose different ports. Because k3s version is not specified, the clusters will run against latest k3s. @@ -206,7 +211,7 @@ For more details see: ### Multi Cluster on isolated networks ```yaml - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 1st Cluster in 172.20.0.0/24" id: test-cluster-1 with: @@ -214,14 +219,14 @@ For more details see: network: "nw01" subnet-CIDR: "172.20.0.0/24" args: >- - -p "80:80@agent[0]" - -p "443:443@agent[0]" - -p "5053:53/udp@agent[0]" + -p "80:80@agent:0:direct" + -p "443:443@agent:0:direct" + -p "5053:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 2nd Cluster in 172.20.1.0/24" id: test-cluster-2 with: @@ -229,12 +234,12 @@ For more details see: network: "nw02" subnet-CIDR: "172.20.1.0/24" args: >- - -p "81:80@agent[0]" - -p "444:443@agent[0]" - -p "5054:53/udp@agent[0]" + -p "81:80@agent:0:direct" + -p "444:443@agent:0:direct" + -p "5054:53/udp@agent:0:direct" --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: Cluster info run: | @@ -254,7 +259,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query [Source](./.github/workflows/multi-cluster-on-isolated-networks.yaml) ### Two pairs of clusters on two isolated networks ```yaml - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 1st Cluster in 172.20.0.0/24" with: cluster-name: "test-cluster-1-a" @@ -263,9 +268,9 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 2nd Cluster in 172.20.0.0/24" with: cluster-name: "test-cluster-2-a" @@ -273,9 +278,9 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 1st Cluster in 172.20.1.0/24" with: cluster-name: "test-cluster-1-b" @@ -284,9 +289,9 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 name: "Create 2nd Cluster in 172.20.1.0/24" with: cluster-name: "test-cluster-2-b" @@ -294,7 +299,7 @@ For more details see: [Demo](https://github.com/AbsaOSS/k3d-action/actions?query args: >- --agents 1 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" ``` As you can see, `test-cluster-2-a` doesn't specify subnet-CIDR, because it inherits CIDR from `test-cluster-1-a`, but network `nw01` is shared. The same for `test-cluster-2-b` and `test-cluster-1-b`. @@ -315,7 +320,7 @@ Example below demonstrates how to interact with imported docker registry: ```yaml steps: - uses: actions/checkout@v2 - - uses: AbsaOSS/k3d-action@v1.5.0 + - uses: AbsaOSS/k3d-action@v1.6.0 id: single-cluster name: "Create single k3d Cluster with imported Registry" with: @@ -323,7 +328,7 @@ Example below demonstrates how to interact with imported docker registry: args: >- --agents 3 --no-lb - --k3s-server-arg "--no-deploy=traefik,servicelb,metrics-server" + --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" - name: "Docker repo demo" run: | docker build . -t myproj/demo:v1.0.0 diff --git a/run.sh b/run.sh index 1a48d9c..ac26896 100755 --- a/run.sh +++ b/run.sh @@ -25,7 +25,7 @@ CYAN= RED= NC= K3D_URL=https://raw.githubusercontent.com/rancher/k3d/main/install.sh -K3D_VERSION=v4.4.7 +K3D_VERSION=v5.1.0 DEFAULT_NETWORK=k3d-action-bridge-network DEFAULT_SUBNET=172.16.0.0/24 NOT_FOUND=k3d-not-found-network