From c2ce16ac3782db57fa876de5d50860d4c895def4 Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Wed, 9 Jun 2021 17:30:59 +0000 Subject: [PATCH] commit e98ff9a964ad70d2cee740f34e8374ffe0e27591 Author: iwilltry42 Date: Wed Jun 9 19:30:28 2021 +0200 docs: cleanup, fix formatting, etc. --- 404.html | 14 +- faq/faq/index.html | 79 +- faq/v1vsv3-comparison/index.html | 1070 ----------------- index.html | 26 +- internals/defaults/index.html | 119 +- internals/networking/index.html | 29 +- search/search_index.json | 2 +- sitemap.xml | 5 - sitemap.xml.gz | Bin 465 -> 449 bytes usage/commands/index.html | 14 +- usage/commands/k3d/index.html | 14 +- usage/commands/k3d_cluster/index.html | 14 +- usage/commands/k3d_cluster_create/index.html | 14 +- usage/commands/k3d_cluster_delete/index.html | 14 +- usage/commands/k3d_cluster_list/index.html | 14 +- usage/commands/k3d_cluster_start/index.html | 14 +- usage/commands/k3d_cluster_stop/index.html | 14 +- usage/commands/k3d_completion/index.html | 14 +- usage/commands/k3d_config/index.html | 14 +- usage/commands/k3d_config_init/index.html | 14 +- usage/commands/k3d_docgen/index.html | 14 +- usage/commands/k3d_image/index.html | 14 +- usage/commands/k3d_image_import/index.html | 14 +- usage/commands/k3d_kubeconfig/index.html | 14 +- usage/commands/k3d_kubeconfig_get/index.html | 14 +- .../commands/k3d_kubeconfig_merge/index.html | 14 +- usage/commands/k3d_node/index.html | 14 +- usage/commands/k3d_node_create/index.html | 14 +- usage/commands/k3d_node_delete/index.html | 14 +- usage/commands/k3d_node_list/index.html | 14 +- usage/commands/k3d_node_start/index.html | 14 +- usage/commands/k3d_node_stop/index.html | 14 +- usage/commands/k3d_registry/index.html | 14 +- usage/commands/k3d_registry_create/index.html | 14 +- usage/commands/k3d_registry_delete/index.html | 14 +- usage/commands/k3d_registry_list/index.html | 14 +- usage/commands/k3d_version/index.html | 14 +- usage/configfile/index.html | 36 +- usage/guides/calico/index.html | 106 +- usage/guides/cuda/index.html | 31 +- usage/guides/exposing_services/index.html | 59 +- usage/guides/registries/index.html | 43 +- usage/kubeconfig/index.html | 82 +- usage/multiserver/index.html | 36 +- 44 files changed, 367 insertions(+), 1762 deletions(-) delete mode 100644 faq/v1vsv3-comparison/index.html diff --git a/404.html b/404.html index de07673a..c33dab1a 100644 --- a/404.html +++ b/404.html @@ -12,7 +12,7 @@ - + @@ -809,18 +809,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/faq/faq/index.html b/faq/faq/index.html index ae42b6d6..76764ae0 100644 --- a/faq/faq/index.html +++ b/faq/faq/index.html @@ -14,7 +14,7 @@ - + @@ -927,18 +927,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - @@ -1067,14 +1055,14 @@

    Issues with BTRFS

    Issues with ZFS

    @@ -1084,10 +1072,12 @@

    k3d demo repository: iwilltry42/k3d-demo

    Featured use-cases include:

    -

    - hot-reloading of code when developing on k3d (Python Flask App) - - build-deploy-test cycle using Tilt - - full cluster lifecycle for simple and multi-server clusters - - Proof of Concept of using k3d as a service in Drone CI

    +
      +
    • hot-reloading of code when developing on k3d (Python Flask App)
    • +
    • build-deploy-test cycle using Tilt
    • +
    • full cluster lifecycle for simple and multi-server clusters
    • +
    • Proof of Concept of using k3d as a service in Drone CI
    • +
    @@ -865,6 +904,42 @@ + + + @@ -881,33 +956,31 @@

    Defaults

    +

    Multiple server nodes

    diff --git a/usage/commands/k3d/index.html b/usage/commands/k3d/index.html index 8e1c2b93..30d25add 100644 --- a/usage/commands/k3d/index.html +++ b/usage/commands/k3d/index.html @@ -14,7 +14,7 @@ - + @@ -883,18 +883,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster/index.html b/usage/commands/k3d_cluster/index.html index c58f1bf9..b040b046 100644 --- a/usage/commands/k3d_cluster/index.html +++ b/usage/commands/k3d_cluster/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster_create/index.html b/usage/commands/k3d_cluster_create/index.html index a6ddfca8..8fd37cb9 100644 --- a/usage/commands/k3d_cluster_create/index.html +++ b/usage/commands/k3d_cluster_create/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster_delete/index.html b/usage/commands/k3d_cluster_delete/index.html index 7adb2eb8..e4fc4b5d 100644 --- a/usage/commands/k3d_cluster_delete/index.html +++ b/usage/commands/k3d_cluster_delete/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster_list/index.html b/usage/commands/k3d_cluster_list/index.html index 57b03960..ee8a2a9a 100644 --- a/usage/commands/k3d_cluster_list/index.html +++ b/usage/commands/k3d_cluster_list/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster_start/index.html b/usage/commands/k3d_cluster_start/index.html index caa23035..7a4f66b9 100644 --- a/usage/commands/k3d_cluster_start/index.html +++ b/usage/commands/k3d_cluster_start/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_cluster_stop/index.html b/usage/commands/k3d_cluster_stop/index.html index 4cffe1f1..dabfc914 100644 --- a/usage/commands/k3d_cluster_stop/index.html +++ b/usage/commands/k3d_cluster_stop/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_completion/index.html b/usage/commands/k3d_completion/index.html index bf9b0eed..8d56021a 100644 --- a/usage/commands/k3d_completion/index.html +++ b/usage/commands/k3d_completion/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_config/index.html b/usage/commands/k3d_config/index.html index 9f98dd16..78a0a12c 100644 --- a/usage/commands/k3d_config/index.html +++ b/usage/commands/k3d_config/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_config_init/index.html b/usage/commands/k3d_config_init/index.html index 19664e1f..a144ad6b 100644 --- a/usage/commands/k3d_config_init/index.html +++ b/usage/commands/k3d_config_init/index.html @@ -14,7 +14,7 @@ - + @@ -883,18 +883,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_docgen/index.html b/usage/commands/k3d_docgen/index.html index 04129393..bb55bd22 100644 --- a/usage/commands/k3d_docgen/index.html +++ b/usage/commands/k3d_docgen/index.html @@ -14,7 +14,7 @@ - + @@ -883,18 +883,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_image/index.html b/usage/commands/k3d_image/index.html index 89931733..55570441 100644 --- a/usage/commands/k3d_image/index.html +++ b/usage/commands/k3d_image/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_image_import/index.html b/usage/commands/k3d_image_import/index.html index cd959ccf..880ace8e 100644 --- a/usage/commands/k3d_image_import/index.html +++ b/usage/commands/k3d_image_import/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_kubeconfig/index.html b/usage/commands/k3d_kubeconfig/index.html index efb0d0f4..0aa5efb1 100644 --- a/usage/commands/k3d_kubeconfig/index.html +++ b/usage/commands/k3d_kubeconfig/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_kubeconfig_get/index.html b/usage/commands/k3d_kubeconfig_get/index.html index 659e1cee..5a207524 100644 --- a/usage/commands/k3d_kubeconfig_get/index.html +++ b/usage/commands/k3d_kubeconfig_get/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_kubeconfig_merge/index.html b/usage/commands/k3d_kubeconfig_merge/index.html index 198f0f82..6c8a7c58 100644 --- a/usage/commands/k3d_kubeconfig_merge/index.html +++ b/usage/commands/k3d_kubeconfig_merge/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node/index.html b/usage/commands/k3d_node/index.html index b407d954..510d6da2 100644 --- a/usage/commands/k3d_node/index.html +++ b/usage/commands/k3d_node/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node_create/index.html b/usage/commands/k3d_node_create/index.html index 198551e5..ffebaeff 100644 --- a/usage/commands/k3d_node_create/index.html +++ b/usage/commands/k3d_node_create/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node_delete/index.html b/usage/commands/k3d_node_delete/index.html index d2c29600..7e59badb 100644 --- a/usage/commands/k3d_node_delete/index.html +++ b/usage/commands/k3d_node_delete/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node_list/index.html b/usage/commands/k3d_node_list/index.html index bbf161aa..7b8dfbab 100644 --- a/usage/commands/k3d_node_list/index.html +++ b/usage/commands/k3d_node_list/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node_start/index.html b/usage/commands/k3d_node_start/index.html index 87c775fd..084c82c6 100644 --- a/usage/commands/k3d_node_start/index.html +++ b/usage/commands/k3d_node_start/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_node_stop/index.html b/usage/commands/k3d_node_stop/index.html index d209e920..04465c4c 100644 --- a/usage/commands/k3d_node_stop/index.html +++ b/usage/commands/k3d_node_stop/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_registry/index.html b/usage/commands/k3d_registry/index.html index cca37da9..c11eec01 100644 --- a/usage/commands/k3d_registry/index.html +++ b/usage/commands/k3d_registry/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_registry_create/index.html b/usage/commands/k3d_registry_create/index.html index 2442decc..cf7263dc 100644 --- a/usage/commands/k3d_registry_create/index.html +++ b/usage/commands/k3d_registry_create/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_registry_delete/index.html b/usage/commands/k3d_registry_delete/index.html index 9f0a47c9..2f264b68 100644 --- a/usage/commands/k3d_registry_delete/index.html +++ b/usage/commands/k3d_registry_delete/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_registry_list/index.html b/usage/commands/k3d_registry_list/index.html index 9b0b7a2f..ef84f986 100644 --- a/usage/commands/k3d_registry_list/index.html +++ b/usage/commands/k3d_registry_list/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/commands/k3d_version/index.html b/usage/commands/k3d_version/index.html index 194fe695..bca7d872 100644 --- a/usage/commands/k3d_version/index.html +++ b/usage/commands/k3d_version/index.html @@ -14,7 +14,7 @@ - + @@ -890,18 +890,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - diff --git a/usage/configfile/index.html b/usage/configfile/index.html index d66269b1..fc22d23f 100644 --- a/usage/configfile/index.html +++ b/usage/configfile/index.html @@ -14,7 +14,7 @@ - + @@ -906,18 +906,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - @@ -1023,11 +1011,11 @@

    Config File

    Introduction

    -

    As of k3d v4.0.0, released in January 2021, k3d ships with configuration file support for the k3d cluster create command. +

    As of k3d v4.0.0, released in January 2021, k3d ships with configuration file support for the k3d cluster create command.
    This allows you to define all the things that you defined with CLI flags before in a nice and tidy YAML (as a Kubernetes user, we know you love it ;) ).

    Syntax & Semantics

    -

    The options defined in the config file are not 100% the same as the CLI flags. +

    The options defined in the config file are not 100% the same as the CLI flags.
    This concerns naming and style/usage/structure, e.g.

    • --api-port is split up into a field named kubeAPI that has 3 different “child fields” (host, hostIP and hostPort)
    • @@ -1053,13 +1041,13 @@ This concerns naming and style/usage/structure, e.g.

      kind: Simple

    Config Options

    -

    The configuration options for k3d are continuously evolving and so is the config file (syntax) itself. +

    The configuration options for k3d are continuously evolving and so is the config file (syntax) itself.
    Currently, the config file is still in an Alpha-State, meaning, that it is subject to change anytime (though we try to keep breaking changes low).

    Validation via JSON-Schema

    -

    k3d uses a JSON-Schema to describe the expected format and fields of the configuration file. -This schema is also used to validate a user-given config file. -This JSON-Schema can be found in the specific config version sub-directory in the repository (e.g. here for v1alpha2) and could be used to lookup supported fields or by linters to validate the config file, e.g. in your code editor.

    +

    k3d uses a JSON-Schema to describe the expected format and fields of the configuration file.
    +This schema is also used to validate a user-given config file.
    +This JSON-Schema can be found in the specific config version sub-directory in the repository (e.g. here for v1alpha2) and could be used to lookup supported fields or by linters to validate the config file, e.g. in your code editor.

    All Options: Example

    Since the config options and the config file are changing quite a bit, it’s hard to keep track of all the supported config file settings, so here’s an example showing all of them as of the time of writing:

    @@ -1121,14 +1109,16 @@ This JSON-Schema can be found in the specific config version sub-directory in th gpuRequest: all # same as `--gpus all`

    Config File vs. CLI Flags

    -

    k3d uses Cobra and Viper for CLI and general config handling respectively. +

    k3d uses Cobra and Viper for CLI and general config handling respectively.
    This automatically introduces a “config option order of priority” (precedence order):

    Config Precedence Order

    -

    Source: spf13/viper#why-viper

    +

    Source: spf13/viper#why-viper

    +

    Internal Setting > CLI Flag > Environment Variable > Config File > (k/v store >) Defaults

    +
    -

    This means, that you can define e.g. a “base configuration file” with settings that you share across different clusters and override only the fields that differ between those clusters in your CLI flags/arguments. +

    This means, that you can define e.g. a “base configuration file” with settings that you share across different clusters and override only the fields that differ between those clusters in your CLI flags/arguments.
    For example, you use the same config file to create three clusters which only have different names and kubeAPI (--api-port) settings.

    References

    @@ -957,55 +945,65 @@

    Use Calico instead of Flannel

    If you want to use NetworkPolicy you can use Calico in k3s instead of Flannel.

    -

    1. Download and modify the Calico descriptor

    +

    1. Download and modify the Calico descriptor

    You can following the documentation

    -

    And then you have to change the ConfigMap calico-config. On the cni_network_config add the entry for allowing IP forwarding
    -

        "container_settings": {
    -        "allow_ip_forwarding": true
    -    }
    +

    And then you have to change the ConfigMap calico-config. On the cni_network_config add the entry for allowing IP forwarding

    +
    "container_settings": {
    +    "allow_ip_forwarding": true
    +}
     
    -Or you can directly use this calico.yaml manifest

    +

    Or you can directly use this calico.yaml manifest

    2. Create the cluster without flannel and with calico

    -

    On the k3s cluster creation : -- add the flag --flannel-backend=none. For this, on k3d you need to forward this flag to k3s with the option --k3s-server-arg. -- mount (--volume) the calico descriptor in the auto deploy manifest directory of k3s /var/lib/rancher/k3s/server/manifests/

    -

    So the command of the cluster creation is (when you are at root of the k3d repository) -

        k3d cluster create "${clustername}" --k3s-server-arg '--flannel-backend=none' --volume "$(pwd)/docs/usage/guides/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml"
    +

    On the k3s cluster creation :

    +
      +
    • add the flag --flannel-backend=none. For this, on k3d you need to forward this flag to k3s with the option --k3s-server-arg.
    • +
    • mount (--volume) the calico descriptor in the auto deploy manifest directory of k3s /var/lib/rancher/k3s/server/manifests/
    • +
    +

    So the command of the cluster creation is (when you are at root of the k3d repository)

    +
    k3d cluster create "${clustername}" \
    +  --k3s-server-arg '--flannel-backend=none' \
    +  --volume "$(pwd)/docs/usage/guides/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml"
     
    -In this example : -- change "${clustername}" with the name of the cluster (or set a variable). -- $(pwd)/docs/usage/guides/calico.yaml is the absolute path of the calico manifest, you can adapt it.

    +

    In this example :

    +
      +
    • change "${clustername}" with the name of the cluster (or set a variable).
    • +
    • $(pwd)/docs/usage/guides/calico.yaml is the absolute path of the calico manifest, you can adapt it.
    • +

    You can add other options, see.

    The cluster will start without flannel and with Calico as CNI Plugin.

    -

    For watching for the pod(s) deployment -

        watch "kubectl get pods -n kube-system"    
    -

    -

    You will have something like this at beginning (with the command line kubectl get pods -n kube-system) +

    For watching for the pod(s) deployment

    +
    watch "kubectl get pods -n kube-system"    
    +
    +

    You will have something like this at beginning (with the command line kubectl get pods -n kube-system)

    NAME                                       READY   STATUS     RESTARTS   AGE
    -helm-install-traefik-pn84f                 0/1     Pending    0          3s
    -calico-node-97rx8                          0/1     Init:0/3   0          3s
    -metrics-server-7566d596c8-hwnqq            0/1     Pending    0          2s
    -calico-kube-controllers-58b656d69f-2z7cn   0/1     Pending    0          2s
    -local-path-provisioner-6d59f47c7-rmswg     0/1     Pending    0          2s
    -coredns-8655855d6-cxtnr                    0/1     Pending    0          2s
    -

    -

    And when it finish to start +helm-install-traefik-pn84f 0/1 Pending 0 3s +calico-node-97rx8 0/1 Init:0/3 0 3s +metrics-server-7566d596c8-hwnqq 0/1 Pending 0 2s +calico-kube-controllers-58b656d69f-2z7cn 0/1 Pending 0 2s +local-path-provisioner-6d59f47c7-rmswg 0/1 Pending 0 2s +coredns-8655855d6-cxtnr 0/1 Pending 0 2s +

    +

    And when it finish to start

    NAME                                       READY   STATUS      RESTARTS   AGE
    -metrics-server-7566d596c8-hwnqq            1/1     Running     0          56s
    -calico-node-97rx8                          1/1     Running     0          57s
    -helm-install-traefik-pn84f                 0/1     Completed   1          57s
    -svclb-traefik-lmjr5                        2/2     Running     0          28s
    -calico-kube-controllers-58b656d69f-2z7cn   1/1     Running     0          56s
    -local-path-provisioner-6d59f47c7-rmswg     1/1     Running     0          56s
    -traefik-758cd5fc85-x8p57                   1/1     Running     0          28s
    -coredns-8655855d6-cxtnr                    1/1     Running     0          56s
    -

    -

    Note : -- you can use the auto deploy manifest or a kubectl apply depending on your needs -- <!> Calico is not as quick as Flannel (but it provides more features)

    +metrics-server-7566d596c8-hwnqq 1/1 Running 0 56s +calico-node-97rx8 1/1 Running 0 57s +helm-install-traefik-pn84f 0/1 Completed 1 57s +svclb-traefik-lmjr5 2/2 Running 0 28s +calico-kube-controllers-58b656d69f-2z7cn 1/1 Running 0 56s +local-path-provisioner-6d59f47c7-rmswg 1/1 Running 0 56s +traefik-758cd5fc85-x8p57 1/1 Running 0 28s +coredns-8655855d6-cxtnr 1/1 Running 0 56s +
    +

    Note :

    +

    References

    -

    https://rancher.com/docs/k3s/latest/en/installation/network-options/
    -https://docs.projectcalico.org/getting-started/kubernetes/k3s/

    + @@ -1014,7 +1012,7 @@ https://docs.projectcalico.org/getting-started/kubernetes/k3s/

    - Last update: January 5, 2021 + Last update: June 9, 2021 diff --git a/usage/guides/cuda/index.html b/usage/guides/cuda/index.html index efeb68b0..630f2e92 100644 --- a/usage/guides/cuda/index.html +++ b/usage/guides/cuda/index.html @@ -14,7 +14,7 @@ - + @@ -922,18 +922,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - @@ -1052,11 +1040,14 @@

    Running CUDA workloads

    -

    If you want to run CUDA workloads on the K3S container you need to customize the container. -CUDA workloads require the NVIDIA Container Runtime, so containerd needs to be configured to use this runtime. -The K3S container itself also needs to run with this runtime. If you are using Docker you can install the NVIDIA Container Toolkit.

    +

    If you want to run CUDA workloads on the K3S container you need to customize the container.
    +CUDA workloads require the NVIDIA Container Runtime, so containerd needs to be configured to use this runtime.
    +The K3S container itself also needs to run with this runtime.
    +If you are using Docker you can install the NVIDIA Container Toolkit.

    Building a customized K3S image

    -

    To get the NVIDIA container runtime in the K3S image you need to build your own K3S image. The native K3S image is based on Alpine but the NVIDIA container runtime is not supported on Alpine yet. To get around this we need to build the image with a supported base image.

    +

    To get the NVIDIA container runtime in the K3S image you need to build your own K3S image.
    +The native K3S image is based on Alpine but the NVIDIA container runtime is not supported on Alpine yet.
    +To get around this we need to build the image with a supported base image.

    Adapt the Dockerfile

    FROM ubuntu:18.04 as base
     RUN apt-get update -y && apt-get install -y ca-certificates
    @@ -1097,7 +1088,7 @@ The K3S container itself also needs to run with this runtime. If you are using D
     ENTRYPOINT ["/bin/k3s"]
     CMD ["agent"]
     
    -

    This Dockerfile is based on the K3S Dockerfile. +

    This Dockerfile is based on the K3s Dockerfile. The following changes are applied:

    1. Change the base images to Ubuntu 18.04 so the NVIDIA Container Runtime can be installed
    2. @@ -1105,7 +1096,7 @@ The following changes are applied:

    3. Add a manifest for the NVIDIA driver plugin for Kubernetes

    Configure containerd

    -

    We need to configure containerd to use the NVIDIA Container Runtime. We need to customize the config.toml that is used at startup. K3S provides a way to do this using a config.toml.tmpl file. More information can be found on the K3S site.

    +

    We need to configure containerd to use the NVIDIA Container Runtime. We need to customize the config.toml that is used at startup. K3s provides a way to do this using a config.toml.tmpl file. More information can be found on the K3s site.

    [plugins.opt]
       path = "{{ .NodeConfig.Containerd.Opt }}"
     
    @@ -1281,7 +1272,7 @@ kubectl logs cuda-vector-add
     
    - Last update: January 5, 2021 + Last update: June 9, 2021 diff --git a/usage/guides/exposing_services/index.html b/usage/guides/exposing_services/index.html index 190b32df..d7e46d5c 100644 --- a/usage/guides/exposing_services/index.html +++ b/usage/guides/exposing_services/index.html @@ -14,7 +14,7 @@ - + @@ -867,18 +867,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - @@ -943,7 +931,7 @@

    Exposing Services

    -

    In this example, we will deploy a simple nginx webserver deployment and make it accessible via ingress. +

    In this example, we will deploy a simple nginx webserver deployment and make it accessible via ingress.
    Therefore, we have to create the cluster in a way, that the internal port 80 (where the traefik ingress controller is listening on) is exposed on the host system.

    1. @@ -952,11 +940,16 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh

      Good to know

        -
      • --api-port 6550 is not required for the example to work. It’s used to have k3s‘s API-Server listening on port 6550 with that port mapped to the host system.
      • -
      • the port-mapping construct 8081:80@loadbalancer means - - map port 8081 from the host to port 80 on the container which matches the nodefilter loadbalancer
      • -
      • the loadbalancer nodefilter matches only the serverlb that’s deployed in front of a cluster’s server nodes - - all ports exposed on the serverlb will be proxied to the same ports on all server nodes in the cluster
      • +
      • --api-port 6550 is not required for the example to work.
        + It’s used to have k3s‘s API-Server listening on port 6550 with that port mapped to the host system.
      • +
      • the port-mapping construct 8081:80@loadbalancer means:
        + “map port 8081 from the host to port 80 on the container which matches the nodefilter loadbalancer
          +
        • the loadbalancer nodefilter matches only the serverlb that’s deployed in front of a cluster’s server nodes
            +
          • all ports exposed on the serverlb will be proxied to the same ports on all server nodes in the cluster
          • +
          +
        • +
        +
    2. @@ -973,8 +966,8 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh

      kubectl create service clusterip nginx --tcp=80:80

    3. -

      Create an ingress object for it with kubectl apply -f - Note: k3s deploys traefik as the default ingress controller

      +

      Create an ingress object for it by copying the following manifest to a file and applying with kubectl apply -f thatfile.yaml

      +

      Note: k3s deploys traefik as the default ingress controller

      # apiVersion: networking.k8s.io/v1beta1 # for k3s < v1.19
       apiVersion: networking.k8s.io/v1
       kind: Ingress
      @@ -1002,16 +995,22 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh
       

    2. via NodePort

      -
    1. Create a cluster, mapping the port 30080 from agent-0 to localhost:8082

      k3d cluster create mycluster -p "8082:30080@agent[0]" --agents 2

      -

      - Note: Kubernetes’ default NodePort range is 30000-32767

      -

      - Note: You may as well expose the whole NodePort range from the very beginning, e.g. via k3d cluster create mycluster --agents 3 -p "30000-32767:30000-32767@server[0]" (See this video from @portainer) - - Warning: Docker creates iptable entries and a new proxy process per port-mapping, so this may take a very long time or even freeze your system!

      -
    2. -
    -

    … (Steps 2 and 3 like above) …

    -
    1. -

      Create a NodePort service for it with kubectl apply -f

      +

      Create a cluster, mapping the port 30080 from agent-0 to localhost:8082

      +

      k3d cluster create mycluster -p "8082:30080@agent[0]" --agents 2

      +
        +
      • Note 1: Kubernetes’ default NodePort range is 30000-32767
      • +
      • +

        Note 2: You may as well expose the whole NodePort range from the very beginning, e.g. via k3d cluster create mycluster --agents 3 -p "30000-32767:30000-32767@server[0]" (See this video from @portainer)

        +
          +
        • Warning: Docker creates iptable entries and a new proxy process per port-mapping, so this may take a very long time or even freeze your system!
        • +
        +

        … (Steps 2 and 3 like above) …

        +
      • +
      +
    2. +
    3. +

      Create a NodePort service for it by copying the following manifest to a file and applying it with kubectl apply -f

      apiVersion: v1
       kind: Service
       metadata:
      diff --git a/usage/guides/registries/index.html b/usage/guides/registries/index.html
      index 86d9835f..daa2808a 100644
      --- a/usage/guides/registries/index.html
      +++ b/usage/guides/registries/index.html
      @@ -14,7 +14,7 @@
               
             
             
      -      
      +      
           
           
             
      @@ -955,18 +955,6 @@
         
       
                 
      -            
      -  
      -  
      -  
      -    
    4. - - Feature Comparison: v1 vs. v3 - -
    5. - - -
    6. @@ -1165,7 +1153,7 @@

    Secure registries

    When using secure registries, the registries.yaml file must include information about the certificates. For example, if you want to use images from the secure registry running at https://my.company.registry, you must first download a CA file valid for that server and store it in some well-known directory like ${HOME}/.k3d/my-company-root.pem.

    -

    Then you have to mount the CA file in some directory in the nodes in the cluster and include that mounted file in a configs section in the registries.yaml file. +

    Then you have to mount the CA file in some directory in the nodes in the cluster and include that mounted file in a configs section in the registries.yaml file.
    For example, if we mount the CA file in /etc/ssl/certs/my-company-root.pem, the registries.yaml will look like:

    mirrors:
       my.company.registry:
    @@ -1179,7 +1167,10 @@ For example, if we mount the CA file in /etc/ssl/certs/my-company-root.pem
           ca_file: "/etc/ssl/certs/my-company-root.pem"
     

    Finally, we can create the cluster, mounting the CA file in the path we specified in ca_file:

    -

    k3d cluster create --volume "${HOME}/.k3d/my-registries.yaml:/etc/rancher/k3s/registries.yaml" --volume "${HOME}/.k3d/my-company-root.pem:/etc/ssl/certs/my-company-root.pem"

    +
    k3d cluster create \
    +  --volume "${HOME}/.k3d/my-registries.yaml:/etc/rancher/k3s/registries.yaml" \
    +  --volume "${HOME}/.k3d/my-company-root.pem:/etc/ssl/certs/my-company-root.pem"
    +

    Using a local registry

    Using k3d-managed registries

    @@ -1188,10 +1179,16 @@ For example, if we mount the CA file in /etc/ssl/certs/my-company-root.pem

    Create a dedicated registry together with your cluster

      -
    1. k3d cluster create mycluster --registry-create: This creates your cluster mycluster together with a registry container called k3d-mycluster-registry - - k3d sets everything up in the cluster for containerd to be able to pull images from that registry (using the registries.yaml file) - - the port, which the registry is listening on will be mapped to a random port on your host system
    2. -
    3. Check the k3d command output or docker ps -f name=k3d-mycluster-registry to find the exposed port (let’s use 12345 here)
    4. +
    5. +

      k3d cluster create mycluster --registry-create: This creates your cluster mycluster together with a registry container called k3d-mycluster-registry

      +
        +
      • k3d sets everything up in the cluster for containerd to be able to pull images from that registry (using the registries.yaml file)
      • +
      • the port, which the registry is listening on will be mapped to a random port on your host system
      • +
      +
    6. +
    7. +

      Check the k3d command output or docker ps -f name=k3d-mycluster-registry to find the exposed port (let’s use 12345 here)

      +
    8. Pull some image (optional) docker pull alpine:latest, re-tag it to reference your newly created registry docker tag alpine:latest k3d-mycluster-registry:12345/testimage:local and push it docker push k3d-mycluster-registry:12345/testimage:local
    9. Use kubectl to create a new pod in your cluster using that image to see, if the cluster can pull from the new registry: kubectl run --image k3d-mycluster-registry:12345/testimage:local testimage --command -- tail -f /dev/null (creates a container that will not do anything but keep on running)
    @@ -1231,7 +1228,8 @@ Otherwise, it’s installable using sudo apt install libnss-myhostname
  • push to your registry from your local development machine.
  • use images from that registry in Deployments in your k3d cluster.
  • -

    We will verify these two things for a local registry (located at k3d-registry.localhost:12345) running in your development machine. Things would be basically the same for checking an external registry, but some additional configuration could be necessary in your local machine when using an authenticated or secure registry (please refer to Docker’s documentation for this).

    +

    We will verify these two things for a local registry (located at k3d-registry.localhost:12345) running in your development machine.
    +Things would be basically the same for checking an external registry, but some additional configuration could be necessary in your local machine when using an authenticated or secure registry (please refer to Docker’s documentation for this).

    First, we can download some image (like nginx) and push it to our local registry with:

    docker pull nginx:latest
     docker tag nginx:latest k3d-registry.localhost:5000/nginx:latest
    @@ -1264,8 +1262,7 @@ docker push k3d-registry.localhost:5000/nginx:latest
     

    Then you should check that the pod is running with kubectl get pods -l "app=nginx-test-registry".

    Configuring registries for k3s <= v0.9.1

    -

    k3s servers below v0.9.1 do not recognize the registries.yaml file as described in -the in the beginning, so you will need to embed the contents of that file in a containerd configuration file. +

    k3s servers below v0.9.1 do not recognize the registries.yaml file as described in the in the beginning, so you will need to embed the contents of that file in a containerd configuration file.
    You will have to create your own containerd configuration file at some well-known path like ${HOME}/.k3d/config.toml.tmpl, like this:

    config.toml.tmpl
    # Original section: no changes
     [plugins.opt]
    @@ -1305,7 +1302,7 @@ You will have to create your own containerd configuration file at s
     
    - Last update: March 11, 2021 + Last update: June 9, 2021 diff --git a/usage/kubeconfig/index.html b/usage/kubeconfig/index.html index d10af90f..c59fa8b5 100644 --- a/usage/kubeconfig/index.html +++ b/usage/kubeconfig/index.html @@ -14,7 +14,7 @@ - + @@ -872,18 +872,6 @@ - - - - -
  • - - Feature Comparison: v1 vs. v3 - -
  • - - - @@ -954,7 +942,7 @@

    Handling Kubeconfigs

    -

    By default, k3d will update your default kubeconfig with your new cluster’s details and set the current-context to it (can be disabled). +

    By default, k3d will update your default kubeconfig with your new cluster’s details and set the current-context to it (can be disabled).
    To get a kubeconfig set up for you to connect to a k3d cluster without this automatism, you can go different ways.

    What is the default kubeconfig?

    We determine the path of the used or default kubeconfig in two ways:

      @@ -964,35 +952,59 @@ To get a kubeconfig set up for you to connect to a k3d cluster without this auto

    Getting the kubeconfig for a newly created cluster

      -
    1. Create a new kubeconfig file after cluster creation - - k3d kubeconfig write mycluster - - Note: this will create (or update) the file $HOME/.k3d/kubeconfig-mycluster.yaml - - Tip: Use it: export KUBECONFIG=$(k3d kubeconfig write mycluster) - - Note 2: alternatively you can use k3d kubeconfig get mycluster > some-file.yaml
    2. -
    3. Update your default kubeconfig upon cluster creation (DEFAULT) - - k3d cluster create mycluster --kubeconfig-update-default - - Note: this won’t switch the current-context (append --kubeconfig-switch-context to do so)
    4. -
    5. Update your default kubeconfig after cluster creation - - k3d kubeconfig merge mycluster --kubeconfig-merge-default - - Note: this won’t switch the current-context (append --kubeconfig-switch-context to do so)
    6. -
    7. Update a different kubeconfig after cluster creation - - k3d kubeconfig merge mycluster --output some/other/file.yaml - - Note: this won’t switch the current-context - - The file will be created if it doesn’t exist
    8. +
    9. +

      Create a new kubeconfig file after cluster creation

      +
        +
      • k3d kubeconfig write mycluster
          +
        • Note: this will create (or update) the file $HOME/.k3d/kubeconfig-mycluster.yaml
        • +
        • Tip: Use it: export KUBECONFIG=$(k3d kubeconfig write mycluster)
        • +
        • Note 2: alternatively you can use k3d kubeconfig get mycluster > some-file.yaml
        • +
        +
      • +
      +
    10. +
    11. +

      Update your default kubeconfig upon cluster creation (DEFAULT)

      +
        +
      • k3d cluster create mycluster --kubeconfig-update-default
          +
        • Note: this won’t switch the current-context (append --kubeconfig-switch-context to do so)
        • +
        +
      • +
      +
    12. +
    13. +

      Update your default kubeconfig after cluster creation

      +
        +
      • k3d kubeconfig merge mycluster --kubeconfig-merge-default
          +
        • Note: this won’t switch the current-context (append --kubeconfig-switch-context to do so)
        • +
        +
      • +
      +
    14. +
    15. +

      Update a different kubeconfig after cluster creation

      +
        +
      • k3d kubeconfig merge mycluster --output some/other/file.yaml
          +
        • Note: this won’t switch the current-context
        • +
        +
      • +
      • The file will be created if it doesn’t exist
      • +
      +

    Switching the current context

    -

    None of the above options switch the current-context by default. -This is intended to be least intrusive, since the current-context has a global effect. +

    None of the above options switch the current-context by default.
    +This is intended to be least intrusive, since the current-context has a global effect.
    You can switch the current-context directly with the kubeconfig merge command by adding the --kubeconfig-switch-context flag.

    Removing cluster details from the kubeconfig

    k3d cluster delete mycluster will always remove the details for mycluster from the default kubeconfig. It will also delete the respective kubeconfig file in $HOME/.k3d/ if it exists.

    Handling multiple clusters

    -

    k3d kubeconfig merge let’s you specify one or more clusters via arguments or all via --all. -All kubeconfigs will then be merged into a single file if --kubeconfig-merge-default or --output is specified. -If none of those two flags was specified, a new file will be created per cluster and the merged path (e.g. $HOME/.k3d/kubeconfig-cluster1.yaml:$HOME/.k3d/cluster2.yaml) will be returned. +

    k3d kubeconfig merge let’s you specify one or more clusters via arguments or all via --all.
    +All kubeconfigs will then be merged into a single file if --kubeconfig-merge-default or --output is specified.
    +If none of those two flags was specified, a new file will be created per cluster and the merged path (e.g. $HOME/.k3d/kubeconfig-cluster1.yaml:$HOME/.k3d/cluster2.yaml) will be returned.
    Note, that with multiple cluster specified, the --kubeconfig-switch-context flag will change the current context to the cluster which was last in the list.

    @@ -1002,7 +1014,7 @@ Note, that with multiple cluster specified, the --kubeconfig-switch-contex
    - Last update: January 5, 2021 + Last update: June 9, 2021 diff --git a/usage/multiserver/index.html b/usage/multiserver/index.html index 13551502..774d096f 100644 --- a/usage/multiserver/index.html +++ b/usage/multiserver/index.html @@ -14,7 +14,7 @@ - + @@ -673,8 +673,8 @@ @@ -909,8 +897,8 @@
    -

    Embedded dqlite

    -

    Create a cluster with 3 server nodes using k3s’ embedded dqlite database. +

    Embedded etcd (old: dqlite)

    +

    Create a cluster with 3 server nodes using k3s’ embedded etcd (old: dqlite) database. The first server to be created will use the --cluster-init flag and k3d will wait for it to be up and running before creating (and connecting) the other server nodes.

    -
        k3d cluster create multiserver --servers 3
    +
    k3d cluster create multiserver --servers 3
     

    Adding server nodes to a running cluster

    In theory (and also in practice in most cases), this is as easy as executing the following command:

    -
        k3d node create newserver --cluster multiserver --role server
    +
    k3d node create newserver --cluster multiserver --role server
     

    There’s a trap!

    -

    If your cluster was initially created with only a single server node, then this will fail. -That’s because the initial server node was not started with the --cluster-init flag and thus is not using the dqlite backend.

    +

    If your cluster was initially created with only a single server node, then this will fail.
    +That’s because the initial server node was not started with the --cluster-init flag and thus is not using the etcd (old: dqlite) backend.

    @@ -967,7 +955,7 @@ That’s because the initial server node was not started with the --cl
    - Last update: February 9, 2021 + Last update: June 9, 2021