Author: iwilltry42 <iwilltry42@gmail.com>
Date:   Wed Jun 9 19:30:28 2021 +0200

    docs: cleanup, fix formatting, etc.
pull/667/head
iwilltry42 3 years ago
parent 0ed286b71d
commit c2ce16ac37
  1. 14
      404.html
  2. 79
      faq/faq/index.html
  3. 1070
      faq/v1vsv3-comparison/index.html
  4. 26
      index.html
  5. 119
      internals/defaults/index.html
  6. 29
      internals/networking/index.html
  7. 2
      search/search_index.json
  8. 5
      sitemap.xml
  9. BIN
      sitemap.xml.gz
  10. 14
      usage/commands/index.html
  11. 14
      usage/commands/k3d/index.html
  12. 14
      usage/commands/k3d_cluster/index.html
  13. 14
      usage/commands/k3d_cluster_create/index.html
  14. 14
      usage/commands/k3d_cluster_delete/index.html
  15. 14
      usage/commands/k3d_cluster_list/index.html
  16. 14
      usage/commands/k3d_cluster_start/index.html
  17. 14
      usage/commands/k3d_cluster_stop/index.html
  18. 14
      usage/commands/k3d_completion/index.html
  19. 14
      usage/commands/k3d_config/index.html
  20. 14
      usage/commands/k3d_config_init/index.html
  21. 14
      usage/commands/k3d_docgen/index.html
  22. 14
      usage/commands/k3d_image/index.html
  23. 14
      usage/commands/k3d_image_import/index.html
  24. 14
      usage/commands/k3d_kubeconfig/index.html
  25. 14
      usage/commands/k3d_kubeconfig_get/index.html
  26. 14
      usage/commands/k3d_kubeconfig_merge/index.html
  27. 14
      usage/commands/k3d_node/index.html
  28. 14
      usage/commands/k3d_node_create/index.html
  29. 14
      usage/commands/k3d_node_delete/index.html
  30. 14
      usage/commands/k3d_node_list/index.html
  31. 14
      usage/commands/k3d_node_start/index.html
  32. 14
      usage/commands/k3d_node_stop/index.html
  33. 14
      usage/commands/k3d_registry/index.html
  34. 14
      usage/commands/k3d_registry_create/index.html
  35. 14
      usage/commands/k3d_registry_delete/index.html
  36. 14
      usage/commands/k3d_registry_list/index.html
  37. 14
      usage/commands/k3d_version/index.html
  38. 36
      usage/configfile/index.html
  39. 106
      usage/guides/calico/index.html
  40. 31
      usage/guides/cuda/index.html
  41. 57
      usage/guides/exposing_services/index.html
  42. 43
      usage/guides/registries/index.html
  43. 82
      usage/kubeconfig/index.html
  44. 36
      usage/multiserver/index.html

@ -12,7 +12,7 @@
<link rel="icon" href="/static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -809,18 +809,6 @@
<li class="md-nav__item">
<a href="/faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/faq/faq/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -927,18 +927,6 @@
<li class="md-nav__item">
<a href="../v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1067,14 +1055,14 @@
<h2 id="issues-with-btrfs">Issues with BTRFS<a class="headerlink" href="#issues-with-btrfs" title="Permanent link">&para;</a></h2>
<ul>
<li>As <a href="https://github.com/jaredallard">@jaredallard</a> <a href="https://github.com/rancher/k3d/pull/48">pointed out</a>, people running <code>k3d</code> on a system with <strong>btrfs</strong>, may need to mount <code>/dev/mapper</code> into the nodes for the setup to work.<ul>
<li>This will do: <code>k3d cluster create CLUSTER_NAME -v /dev/mapper:/dev/mapper</code></li>
<li>This will do: <code class="highlight">k3d cluster create CLUSTER_NAME -v /dev/mapper:/dev/mapper</code></li>
</ul>
</li>
</ul>
<h2 id="issues-with-zfs">Issues with ZFS<a class="headerlink" href="#issues-with-zfs" title="Permanent link">&para;</a></h2>
<ul>
<li>
<p>k3s currently has <a href="https://github.com/rancher/k3s/issues/66">no support for ZFS</a> and thus, creating multi-server setups (e.g. <code>k3d cluster create multiserver --servers 3</code>) fails, because the initializing server node (server flag <code>--cluster-init</code>) errors out with the following log:</p>
<p>k3s currently has <a href="https://github.com/rancher/k3s/issues/66">no support for ZFS</a> and thus, creating multi-server setups (e.g. <code class="highlight">k3d cluster create multiserver --servers <span class="m">3</span></code>) fails, because the initializing server node (server flag <code>--cluster-init</code>) errors out with the following log:</p>
<div class="highlight"><pre><span></span><code>starting kubernetes: preparing server: start cluster and https: raft_init<span class="o">()</span>: io: create I/O capabilities probe file: posix_allocate: operation not supported on socket
</code></pre></div>
<ul>
@ -1091,7 +1079,13 @@
<li>Possible <a href="https://github.com/rancher/k3d/issues/133#issuecomment-549065666">fix/workaround by @zer0def</a>:<ul>
<li>use a docker storage driver which cleans up properly (e.g. overlay2)</li>
<li>clean up or expand docker root filesystem</li>
<li>change the kubelet&rsquo;s eviction thresholds upon cluster creation: <code>k3d cluster create --k3s-agent-arg '--kubelet-arg=eviction-hard=imagefs.available&lt;1%,nodefs.available&lt;1%' --k3s-agent-arg '--kubelet-arg=eviction-minimum-reclaim=imagefs.available=1%,nodefs.available=1%'</code></li>
<li>
<p>change the kubelet&rsquo;s eviction thresholds upon cluster creation:</p>
<div class="highlight"><pre><span></span><code>k3d cluster create <span class="se">\</span>
--k3s-agent-arg <span class="s1">&#39;--kubelet-arg=eviction-hard=imagefs.available&lt;1%,nodefs.available&lt;1%&#39;</span> <span class="se">\</span>
--k3s-agent-arg <span class="s1">&#39;--kubelet-arg=eviction-minimum-reclaim=imagefs.available=1%,nodefs.available=1%&#39;</span>
</code></pre></div>
</li>
</ul>
</li>
</ul>
@ -1110,7 +1104,7 @@
<li>The Problem: Passing a feature flag to the Kubernetes API Server running inside k3s.</li>
<li>Example: you want to enable the EphemeralContainers feature flag in Kubernetes</li>
<li>Solution: <code class="highlight">k3d cluster create --k3s-server-arg <span class="s1">&#39;--kube-apiserver-arg=feature-gates=EphemeralContainers=true&#39;</span></code><ul>
<li>Note: Be aware of where the flags require dashes (<code>--</code>) and where not.<ul>
<li><strong>Note</strong>: Be aware of where the flags require dashes (<code>--</code>) and where not.<ul>
<li>the k3s flag (<code>--kube-apiserver-arg</code>) has the dashes</li>
<li>the kube-apiserver flag <code>feature-gates</code> doesn&rsquo;t have them (k3s adds them internally)</li>
</ul>
@ -1119,8 +1113,17 @@
</li>
</ul>
<ul>
<li>Second example: <code class="highlight">k3d cluster create k3d-one --k3s-server-arg --cluster-cidr<span class="o">=</span><span class="s2">&quot;10.118.0.0/17&quot;</span> --k3s-server-arg --service-cidr<span class="o">=</span><span class="s2">&quot;10.118.128.0/17&quot;</span> --k3s-server-arg --disable<span class="o">=</span>servicelb --k3s-server-arg --disable<span class="o">=</span>traefik --verbose</code><ul>
<li>Note: There are many ways to use the <code>"</code> and <code>'</code> quotes, just be aware, that sometimes shells also try to interpret/interpolate parts of the commands</li>
<li>
<p>Second example:</p>
<div class="highlight"><pre><span></span><code>k3d cluster create k3d-one <span class="se">\</span>
--k3s-server-arg --cluster-cidr<span class="o">=</span><span class="s2">&quot;10.118.0.0/17&quot;</span> <span class="se">\</span>
--k3s-server-arg --service-cidr<span class="o">=</span><span class="s2">&quot;10.118.128.0/17&quot;</span> <span class="se">\</span>
--k3s-server-arg --disable<span class="o">=</span>servicelb <span class="se">\</span>
--k3s-server-arg --disable<span class="o">=</span>traefik <span class="se">\</span>
--verbose
</code></pre></div>
<ul>
<li><strong>Note</strong>: There are many ways to use the <code>"</code> and <code>'</code> quotes, just be aware, that sometimes shells also try to interpret/interpolate parts of the commands</li>
</ul>
</li>
</ul>
@ -1129,11 +1132,17 @@
<li>As of version v3.1.0, we&rsquo;re injecting the <code>host.k3d.internal</code> entry into the k3d containers (k3s nodes) and into the CoreDNS ConfigMap, enabling you to access your host system by referring to it as <code>host.k3d.internal</code></li>
</ul>
<h2 id="running-behind-a-corporate-proxy">Running behind a corporate proxy<a class="headerlink" href="#running-behind-a-corporate-proxy" title="Permanent link">&para;</a></h2>
<p>Running k3d behind a corporate proxy can lead to some issues with k3d that have already been reported in more than one issue.
<p>Running k3d behind a corporate proxy can lead to some issues with k3d that have already been reported in more than one issue.<br />
Some can be fixed by passing the <code>HTTP_PROXY</code> environment variables to k3d, some have to be fixed in docker&rsquo;s <code>daemon.json</code> file and some are as easy as adding a volume mount.</p>
<h3 id="pods-fail-to-start-x509-certificate-signed-by-unknown-authority">Pods fail to start: <code>x509: certificate signed by unknown authority</code><a class="headerlink" href="#pods-fail-to-start-x509-certificate-signed-by-unknown-authority" title="Permanent link">&para;</a></h3>
<ul>
<li>Example Error Message: <code>Failed to create pod sandbox: rpc error: code = Unknown desc = failed to get sandbox image "docker.io/rancher/pause:3.1": failed to pull image "docker.io/rancher/pause:3.1": failed to pull and unpack image "docker.io/rancher/pause:3.1": failed to resolve reference "docker.io/rancher/pause:3.1": failed to do request: Head https://registry-1.docker.io/v2/rancher/pause/manifests/3.1: x509: certificate signed by unknown authority</code></li>
<li>
<p>Example Error Message:</p>
<div class="highlight"><pre><span></span><code>Failed to create pod sandbox: rpc error: <span class="nv">code</span> <span class="o">=</span> Unknown <span class="nv">desc</span> <span class="o">=</span> failed to get sandbox image <span class="s2">&quot;docker.io/rancher/pause:3.1&quot;</span>: failed to pull image <span class="s2">&quot;docker.io/rancher/pause:3.1&quot;</span>: failed to pull and unpack image <span class="s2">&quot;docker.io/rancher/pause:3.1&quot;</span>: failed to resolve reference <span class="s2">&quot;docker.io/rancher/pause:3.1&quot;</span>: failed to <span class="k">do</span> request: Head https://registry-1.docker.io/v2/rancher/pause/manifests/3.1: x509: certificate signed by unknown authority
</code></pre></div>
</li>
</ul>
<ul>
<li>Problem: inside the container, the certificate of the corporate proxy cannot be validated</li>
<li>Possible Solution: Mounting the CA Certificate from your host into the node containers at start time via <code>k3d cluster create --volume /path/to/your/certs.crt:/etc/ssl/certs/yourcert.crt</code></li>
<li>Issue: <a href="https://github.com/rancher/k3d/discussions/535#discussioncomment-474982">rancher/k3d#535</a></li>
@ -1153,7 +1162,16 @@ Some can be fixed by passing the <code>HTTP_PROXY</code> environment variables t
</ul>
</li>
<li>Why: The issue was introduced by a change in the Linux kernel (<a href="https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.12.2">Changelog 5.12.2</a>: <a href="https://github.com/torvalds/linux/commit/671c54ea8c7ff47bd88444f3fffb65bf9799ce43">Commit</a>), that changed the netfilter_conntrack behavior in a way that <code>kube-proxy</code> is not able to set the <code>nf_conntrack_max</code> value anymore</li>
<li>Workaround: as a workaround, we can tell <code>kube-proxy</code> to not even try to set this value: <code>k3d cluster create --k3s-server-arg "--kube-proxy-arg=conntrack-max-per-core=0" --k3s-agent-arg "--kube-proxy-arg=conntrack-max-per-core=0" --image rancher/k3s:v1.20.6-k3s</code></li>
<li>
<p>Workaround: as a workaround, we can tell <code>kube-proxy</code> to not even try to set this value:</p>
<div class="highlight"><pre><span></span><code>k3d cluster create <span class="se">\</span>
--k3s-server-arg <span class="s2">&quot;--kube-proxy-arg=conntrack-max-per-core=0&quot;</span> <span class="se">\</span>
--k3s-agent-arg <span class="s2">&quot;--kube-proxy-arg=conntrack-max-per-core=0&quot;</span> <span class="se">\</span>
--image rancher/k3s:v1.20.6-k3s
</code></pre></div>
</li>
</ul>
<ul>
<li>Fix: This is going to be fixed &ldquo;upstream&rdquo; in k3s itself in <a href="https://github.com/k3s-io/k3s/pull/3337">rancher/k3s#3337</a> and backported to k3s versions as low as v1.18.</li>
<li>Issue Reference: <a href="https://github.com/rancher/k3d/issues/607">rancher/k3s#607</a></li>
</ul>
@ -1165,7 +1183,7 @@ Some can be fixed by passing the <code>HTTP_PROXY</code> environment variables t
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">May 20, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>
@ -1205,21 +1223,6 @@ Some can be fixed by passing the <code>HTTP_PROXY</code> environment variables t
</a>
<a href="../v1vsv3-comparison/" class="md-footer__link md-footer__link--next" aria-label="Next: Feature Comparison: v1 vs. v3" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
Feature Comparison: v1 vs. v3
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">

File diff suppressed because it is too large Load Diff

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/">
<link rel="icon" href="static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -931,18 +931,6 @@
<li class="md-nav__item">
<a href="faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1084,10 +1072,12 @@
<div class="admonition tip">
<p class="admonition-title">k3d demo repository: <a href="https://github.com/iwilltry42/k3d-demo">iwilltry42/k3d-demo</a></p>
<p>Featured use-cases include:</p>
<p>- <strong>hot-reloading</strong> of code when developing on k3d (Python Flask App)
- build-deploy-test cycle using <strong>Tilt</strong>
- full cluster lifecycle for simple and <strong>multi-server</strong> clusters
- Proof of Concept of using k3d as a service in <strong>Drone CI</strong></p>
<ul>
<li><strong>hot-reloading</strong> of code when developing on k3d (Python Flask App)</li>
<li>build-deploy-test cycle using <strong>Tilt</strong></li>
<li>full cluster lifecycle for simple and <strong>multi-server</strong> clusters</li>
<li>Proof of Concept of using k3d as a service in <strong>Drone CI</strong></li>
</ul>
</div>
<ul>
<li><a href="https://www.youtube.com/watch?v=hMr3prm9gDM">Rancher Meetup - May 2020 - Simplifying Your Cloud-Native Development Workflow With K3s, K3c and K3d (YouTube)</a></li>
@ -1219,7 +1209,7 @@
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">May 26, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/internals/defaults/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -766,10 +766,61 @@
<label class="md-nav__link md-nav__link--active" for="__toc">
Defaults
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
Defaults
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#multiple-server-nodes" class="md-nav__link">
Multiple server nodes
</a>
</li>
<li class="md-nav__item">
<a href="#api-ports" class="md-nav__link">
API-Ports
</a>
</li>
<li class="md-nav__item">
<a href="#kubeconfig" class="md-nav__link">
Kubeconfig
</a>
</li>
<li class="md-nav__item">
<a href="#networking" class="md-nav__link">
Networking
</a>
</li>
</ul>
</nav>
</li>
@ -828,18 +879,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -865,6 +904,42 @@
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#multiple-server-nodes" class="md-nav__link">
Multiple server nodes
</a>
</li>
<li class="md-nav__item">
<a href="#api-ports" class="md-nav__link">
API-Ports
</a>
</li>
<li class="md-nav__item">
<a href="#kubeconfig" class="md-nav__link">
Kubeconfig
</a>
</li>
<li class="md-nav__item">
<a href="#networking" class="md-nav__link">
Networking
</a>
</li>
</ul>
</nav>
</div>
</div>
@ -881,33 +956,31 @@
<h1 id="defaults">Defaults<a class="headerlink" href="#defaults" title="Permanent link">&para;</a></h1>
<h2 id="multiple-server-nodes">Multiple server nodes<a class="headerlink" href="#multiple-server-nodes" title="Permanent link">&para;</a></h2>
<ul>
<li>multiple server nodes<ul>
<li>by default, when <code>--server</code> &gt; 1 and no <code>--datastore-x</code> option is set, the first server node (server-0) will be the initializing server node<ul>
<li>the initializing server node will have the <code>--cluster-init</code> flag appended</li>
<li>all other server nodes will refer to the initializing server node via <code>--server https://&lt;init-node&gt;:6443</code></li>
</ul>
</li>
</ul>
</li>
<li>API-Ports<ul>
<h2 id="api-ports">API-Ports<a class="headerlink" href="#api-ports" title="Permanent link">&para;</a></h2>
<ul>
<li>by default, we expose the API-Port (<code>6443</code>) by forwarding traffic from the default server loadbalancer (nginx container) to the server node(s)</li>
<li>port <code>6443</code> of the loadbalancer is then mapped to a specific (<code>--api-port</code> flag) or a random (default) port on the host system</li>
</ul>
</li>
<li>kubeconfig<ul>
<h2 id="kubeconfig">Kubeconfig<a class="headerlink" href="#kubeconfig" title="Permanent link">&para;</a></h2>
<ul>
<li>if <code>--kubeconfig-update-default</code> is set, we use the default loading rules to get the default kubeconfig:<ul>
<li>First: kubeconfig specified via the KUBECONFIG environment variable (error out if multiple are specified)</li>
<li>Second: default kubeconfig in home directory (e.g. <code>$HOME/.kube/config</code>)</li>
</ul>
</li>
</ul>
</li>
<li>Networking<ul>
<h2 id="networking">Networking<a class="headerlink" href="#networking" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="./networking">by default, k3d creates a new (docker) network for every cluster</a></li>
</ul>
</li>
</ul>
@ -916,7 +989,7 @@
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">May 21, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/internals/networking/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -892,18 +892,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1001,18 +989,17 @@
</li>
</ul>
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">&para;</a></h2>
<p>By default, k3d creates a new (docker) network for every new cluster.
Using the <code>--network STRING</code> flag upon creation to connect to an existing network.
<p>By default, k3d creates a new (docker) network for every new cluster.<br />
Using the <code>--network STRING</code> flag upon creation to connect to an existing network.<br />
Existing networks won&rsquo;t be managed by k3d together with the cluster lifecycle.</p>
<h2 id="connecting-to-docker-internalpre-defined-networks">Connecting to docker &ldquo;internal&rdquo;/pre-defined networks<a class="headerlink" href="#connecting-to-docker-internalpre-defined-networks" title="Permanent link">&para;</a></h2>
<h3 id="host-network"><code>host</code> network<a class="headerlink" href="#host-network" title="Permanent link">&para;</a></h3>
<p>When using the <code>--network</code> flag to connect to the host network (i.e. <code>k3d cluster create --network host</code>),
you won&rsquo;t be able to create more than <strong>one server node</strong>.
<p>When using the <code>--network</code> flag to connect to the host network (i.e. <code>k3d cluster create --network host</code>), you won&rsquo;t be able to create more than <strong>one server node</strong>.<br />
An edge case would be one server node (with agent disabled) and one agent node.</p>
<h3 id="bridge-network"><code>bridge</code> network<a class="headerlink" href="#bridge-network" title="Permanent link">&para;</a></h3>
<p>By default, every network that k3d creates is working in <code>bridge</code> mode.
But when you try to use <code>--network bridge</code> to connect to docker&rsquo;s internal <code>bridge</code> network, you may
run into issues with grabbing certificates from the API-Server. Single-Node clusters should work though.</p>
<p>By default, every network that k3d creates is working in <code>bridge</code> mode.<br />
But when you try to use <code>--network bridge</code> to connect to docker&rsquo;s internal <code>bridge</code> network, you may run into issues with grabbing certificates from the API-Server.<br />
Single-Node clusters should work though.</p>
<h3 id="none-network"><code>none</code> &ldquo;network&rdquo;<a class="headerlink" href="#none-network" title="Permanent link">&para;</a></h3>
<p>Well.. this doesn&rsquo;t really make sense for k3d anyway ¯\_(ツ)_/¯</p>
@ -1023,7 +1010,7 @@ run into issues with grabbing certificates from the API-Server. Single-Node clus
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">March 15, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

File diff suppressed because one or more lines are too long

@ -10,11 +10,6 @@
<lastmod>2021-06-09</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://k3d.io/faq/v1vsv3-comparison/</loc>
<lastmod>2021-06-09</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://k3d.io/internals/defaults/</loc>
<lastmod>2021-06-09</lastmod>

Binary file not shown.

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -818,18 +818,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -883,18 +883,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster_create/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster_delete/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster_list/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster_start/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_cluster_stop/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_completion/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_config/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_config_init/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -883,18 +883,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_docgen/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -883,18 +883,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_image/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_image_import/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_kubeconfig/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_kubeconfig_get/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_kubeconfig_merge/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node_create/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node_delete/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node_list/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node_start/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_node_stop/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_registry/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_registry_create/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_registry_delete/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_registry_list/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/commands/k3d_version/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -890,18 +890,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/configfile/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -906,18 +906,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1023,11 +1011,11 @@
<h1 id="config-file">Config File<a class="headerlink" href="#config-file" title="Permanent link">&para;</a></h1>
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">&para;</a></h2>
<p>As of k3d v4.0.0, released in January 2021, k3d ships with configuration file support for the <code>k3d cluster create</code> command.
<p>As of k3d v4.0.0, released in January 2021, k3d ships with configuration file support for the <code>k3d cluster create</code> command.<br />
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 ;) ).</p>
<div class="admonition info">
<p class="admonition-title">Syntax &amp; Semantics</p>
<p>The options defined in the config file are not 100% the same as the CLI flags.
<p>The options defined in the config file are not 100% the same as the CLI flags.<br />
This concerns naming and style/usage/structure, e.g.</p>
<ul>
<li><code>--api-port</code> is split up into a field named <code>kubeAPI</code> that has 3 different &ldquo;child fields&rdquo; (<code>host</code>, <code>hostIP</code> and <code>hostPort</code>)</li>
@ -1053,13 +1041,13 @@ This concerns naming and style/usage/structure, e.g.</p>
<span class="nt">kind</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">Simple</span>
</code></pre></div>
<h2 id="config-options">Config Options<a class="headerlink" href="#config-options" title="Permanent link">&para;</a></h2>
<p>The configuration options for k3d are continuously evolving and so is the config file (syntax) itself.
<p>The configuration options for k3d are continuously evolving and so is the config file (syntax) itself.<br />
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).</p>
<div class="admonition info">
<p class="admonition-title">Validation via JSON-Schema</p>
<p>k3d uses a <a href="https://json-schema.org/">JSON-Schema</a> to describe the expected format and fields of the configuration file.
This schema is also used to <a href="https://github.com/xeipuuv/gojsonschema#validation">validate</a> a user-given config file.
This JSON-Schema can be found in the specific config version sub-directory in the repository (e.g. <a href="https://github.com/rancher/k3d/blob/main/pkg/config/v1alpha2/schema.json">here for <code>v1alpha2</code></a>) and could be used to lookup supported fields or by linters to validate the config file, e.g. in your code editor.</p>
<p>k3d uses a <a href="https://json-schema.org/">JSON-Schema</a> to describe the expected format and fields of the configuration file.<br />
This schema is also used to <a href="https://github.com/xeipuuv/gojsonschema#validation">validate</a> a user-given config file.<br />
This JSON-Schema can be found in the specific config version sub-directory in the repository (e.g. <a href="https://github.com/rancher/k3d/blob/main/pkg/config/v1alpha2/schema.json">here for <code>v1alpha2</code></a>) and could be used to lookup supported fields or by linters to validate the config file, e.g. in your code editor. </p>
</div>
<h3 id="all-options-example">All Options: Example<a class="headerlink" href="#all-options-example" title="Permanent link">&para;</a></h3>
<p>Since the config options and the config file are changing quite a bit, it&rsquo;s hard to keep track of all the supported config file settings, so here&rsquo;s an example showing all of them as of the time of writing:</p>
@ -1121,14 +1109,16 @@ This JSON-Schema can be found in the specific config version sub-directory in th
<span class="nt">gpuRequest</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">all</span> <span class="c1"># same as `--gpus all`</span>
</code></pre></div>
<h2 id="config-file-vs-cli-flags">Config File vs. CLI Flags<a class="headerlink" href="#config-file-vs-cli-flags" title="Permanent link">&para;</a></h2>
<p>k3d uses <a href="https://github.com/spf13/cobra"><code>Cobra</code></a> and <a href="https://github.com/spf13/viper"><code>Viper</code></a> for CLI and general config handling respectively.
<p>k3d uses <a href="https://github.com/spf13/cobra"><code>Cobra</code></a> and <a href="https://github.com/spf13/viper"><code>Viper</code></a> for CLI and general config handling respectively.<br />
This automatically introduces a &ldquo;config option order of priority&rdquo; (<a href="https://github.com/spf13/viper#why-viper">precedence order</a>):</p>
<div class="admonition info">
<p class="admonition-title">Config Precedence Order</p>
<p>Source: <a href="https://github.com/spf13/viper#why-viper">spf13/viper#why-viper</a></p>
<p>Source: <a href="https://github.com/spf13/viper#why-viper">spf13/viper#why-viper</a> </p>
<blockquote>
<p>Internal Setting &gt; <strong>CLI Flag</strong> &gt; Environment Variable &gt; <strong>Config File</strong> &gt; (k/v store &gt;) Defaults</p>
</blockquote>
</div>
<p>This means, that you can define e.g. a &ldquo;base configuration file&rdquo; with settings that you share across different clusters and override only the fields that differ between those clusters in your CLI flags/arguments.
<p>This means, that you can define e.g. a &ldquo;base configuration file&rdquo; with settings that you share across different clusters and override only the fields that differ between those clusters in your CLI flags/arguments.<br />
For example, you use the same config file to create three clusters which only have different names and <code>kubeAPI</code> (<code>--api-port</code>) settings.</p>
<h2 id="references">References<a class="headerlink" href="#references" title="Permanent link">&para;</a></h2>
<ul>
@ -1143,7 +1133,7 @@ For example, you use the same config file to create three clusters which only ha
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">May 6, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/guides/calico/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -874,18 +874,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -957,55 +945,65 @@
<h1 id="use-calico-instead-of-flannel">Use Calico instead of Flannel<a class="headerlink" href="#use-calico-instead-of-flannel" title="Permanent link">&para;</a></h1>
<p>If you want to use NetworkPolicy you can use Calico in k3s instead of Flannel.</p>
<h3 id="1-download-and-modify-the-calico-descriptor">1. Download and modify the Calico descriptor<a class="headerlink" href="#1-download-and-modify-the-calico-descriptor" title="Permanent link">&para;</a></h3>
<h2 id="1-download-and-modify-the-calico-descriptor">1. Download and modify the Calico descriptor<a class="headerlink" href="#1-download-and-modify-the-calico-descriptor" title="Permanent link">&para;</a></h2>
<p>You can following the <a href="https://docs.projectcalico.org/master/reference/cni-plugin/configuration">documentation</a></p>
<p>And then you have to change the ConfigMap <code>calico-config</code>. On the <code>cni_network_config</code> add the entry for allowing IP forwarding<br />
<div class="highlight"><pre><span></span><code> <span class="nt">&quot;container_settings&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;allow_ip_forwarding&quot;</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">}</span>
<p>And then you have to change the ConfigMap <code>calico-config</code>. On the <code>cni_network_config</code> add the entry for allowing IP forwarding </p>
<div class="highlight"><pre><span></span><code><span class="nt">&quot;container_settings&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;allow_ip_forwarding&quot;</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">}</span>
</code></pre></div>
Or you can directly use this <a href="../calico.yaml">calico.yaml</a> manifest</p>
<p>Or you can directly use this <a href="../calico.yaml">calico.yaml</a> manifest</p>
<h2 id="2-create-the-cluster-without-flannel-and-with-calico">2. Create the cluster without flannel and with calico<a class="headerlink" href="#2-create-the-cluster-without-flannel-and-with-calico" title="Permanent link">&para;</a></h2>
<p>On the k3s cluster creation :
- add the flag <code>--flannel-backend=none</code>. For this, on k3d you need to forward this flag to k3s with the option <code>--k3s-server-arg</code>.
- mount (<code>--volume</code>) the calico descriptor in the auto deploy manifest directory of k3s <code>/var/lib/rancher/k3s/server/manifests/</code></p>
<p>So the command of the cluster creation is (when you are at root of the k3d repository)
<div class="highlight"><pre><span></span><code> k3d cluster create <span class="s2">&quot;</span><span class="si">${</span><span class="nv">clustername</span><span class="si">}</span><span class="s2">&quot;</span> --k3s-server-arg <span class="s1">&#39;--flannel-backend=none&#39;</span> --volume <span class="s2">&quot;</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span><span class="s2">/docs/usage/guides/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml&quot;</span>
<p>On the k3s cluster creation :</p>
<ul>
<li>add the flag <code>--flannel-backend=none</code>. For this, on k3d you need to forward this flag to k3s with the option <code>--k3s-server-arg</code>.</li>
<li>mount (<code>--volume</code>) the calico descriptor in the auto deploy manifest directory of k3s <code>/var/lib/rancher/k3s/server/manifests/</code></li>
</ul>
<p>So the command of the cluster creation is (when you are at root of the k3d repository)</p>
<div class="highlight"><pre><span></span><code>k3d cluster create <span class="s2">&quot;</span><span class="si">${</span><span class="nv">clustername</span><span class="si">}</span><span class="s2">&quot;</span> <span class="se">\</span>
--k3s-server-arg <span class="s1">&#39;--flannel-backend=none&#39;</span> <span class="se">\</span>
--volume <span class="s2">&quot;</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span><span class="s2">/docs/usage/guides/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml&quot;</span>
</code></pre></div>
In this example :
- change <code>"${clustername}"</code> with the name of the cluster (or set a variable).
- <code>$(pwd)/docs/usage/guides/calico.yaml</code> is the absolute path of the calico manifest, you can adapt it.</p>
<p>In this example :</p>
<ul>
<li>change <code>"${clustername}"</code> with the name of the cluster (or set a variable).</li>
<li><code>$(pwd)/docs/usage/guides/calico.yaml</code> is the absolute path of the calico manifest, you can adapt it.</li>
</ul>
<p>You can add other options, <a href="../../commands/">see</a>. </p>
<p>The cluster will start without flannel and with Calico as CNI Plugin.</p>
<p>For watching for the pod(s) deployment
<div class="highlight"><pre><span></span><code> watch <span class="s2">&quot;kubectl get pods -n kube-system&quot;</span>
</code></pre></div></p>
<p>You will have something like this at beginning (with the command line <code>kubectl get pods -n kube-system</code>)
<p>For watching for the pod(s) deployment</p>
<div class="highlight"><pre><span></span><code>watch <span class="s2">&quot;kubectl get pods -n kube-system&quot;</span>
</code></pre></div>
<p>You will have something like this at beginning (with the command line <code class="highlight">kubectl get pods -n kube-system</code>)</p>
<div class="highlight"><pre><span></span><code>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
</code></pre></div></p>
<p>And when it finish to start
helm-install-traefik-pn84f <span class="m">0</span>/1 Pending <span class="m">0</span> 3s
calico-node-97rx8 <span class="m">0</span>/1 Init:0/3 <span class="m">0</span> 3s
metrics-server-7566d596c8-hwnqq <span class="m">0</span>/1 Pending <span class="m">0</span> 2s
calico-kube-controllers-58b656d69f-2z7cn <span class="m">0</span>/1 Pending <span class="m">0</span> 2s
local-path-provisioner-6d59f47c7-rmswg <span class="m">0</span>/1 Pending <span class="m">0</span> 2s
coredns-8655855d6-cxtnr <span class="m">0</span>/1 Pending <span class="m">0</span> 2s
</code></pre></div>
<p>And when it finish to start</p>
<div class="highlight"><pre><span></span><code>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
</code></pre></div></p>
<p>Note :
- you can use the auto deploy manifest or a kubectl apply depending on your needs
- &lt;!&gt; Calico is not as quick as Flannel (but it provides more features)</p>
metrics-server-7566d596c8-hwnqq <span class="m">1</span>/1 Running <span class="m">0</span> 56s
calico-node-97rx8 <span class="m">1</span>/1 Running <span class="m">0</span> 57s
helm-install-traefik-pn84f <span class="m">0</span>/1 Completed <span class="m">1</span> 57s
svclb-traefik-lmjr5 <span class="m">2</span>/2 Running <span class="m">0</span> 28s
calico-kube-controllers-58b656d69f-2z7cn <span class="m">1</span>/1 Running <span class="m">0</span> 56s
local-path-provisioner-6d59f47c7-rmswg <span class="m">1</span>/1 Running <span class="m">0</span> 56s
traefik-758cd5fc85-x8p57 <span class="m">1</span>/1 Running <span class="m">0</span> 28s
coredns-8655855d6-cxtnr <span class="m">1</span>/1 Running <span class="m">0</span> 56s
</code></pre></div>
<p>Note :</p>
<ul>
<li>you can use the auto deploy manifest or a kubectl apply depending on your needs</li>
<li><img alt="❗" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/2757.svg" title=":exclamation:" /> Calico is not as quick as Flannel (but it provides more features)</li>
</ul>
<h2 id="references">References<a class="headerlink" href="#references" title="Permanent link">&para;</a></h2>
<p>https://rancher.com/docs/k3s/latest/en/installation/network-options/<br />
https://docs.projectcalico.org/getting-started/kubernetes/k3s/</p>
<ul>
<li><a href="https://rancher.com/docs/k3s/latest/en/installation/network-options/">https://rancher.com/docs/k3s/latest/en/installation/network-options/</a> </li>
<li><a href="https://docs.projectcalico.org/getting-started/kubernetes/k3s/">https://docs.projectcalico.org/getting-started/kubernetes/k3s/</a></li>
</ul>
@ -1014,7 +1012,7 @@ https://docs.projectcalico.org/getting-started/kubernetes/k3s/</p>
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">January 5, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/guides/cuda/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -922,18 +922,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1052,11 +1040,14 @@
<h1 id="running-cuda-workloads">Running CUDA workloads<a class="headerlink" href="#running-cuda-workloads" title="Permanent link">&para;</a></h1>
<p>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 <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html">NVIDIA Container Toolkit</a>.</p>
<p>If you want to run CUDA workloads on the K3S container you need to customize the container.<br />
CUDA workloads require the NVIDIA Container Runtime, so containerd needs to be configured to use this runtime.<br />
The K3S container itself also needs to run with this runtime.<br />
If you are using Docker you can install the <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html">NVIDIA Container Toolkit</a>.</p>
<h2 id="building-a-customized-k3s-image">Building a customized K3S image<a class="headerlink" href="#building-a-customized-k3s-image" title="Permanent link">&para;</a></h2>
<p>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.</p>
<p>To get the NVIDIA container runtime in the K3S image you need to build your own K3S image.<br />
The native K3S image is based on Alpine but the NVIDIA container runtime is not supported on Alpine yet.<br />
To get around this we need to build the image with a supported base image.</p>
<h3 id="adapt-the-dockerfile">Adapt the Dockerfile<a class="headerlink" href="#adapt-the-dockerfile" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><span class="k">FROM</span> <span class="s">ubuntu:18.04</span> <span class="k">as</span> <span class="s">base</span>
<span class="k">RUN</span> apt-get update -y <span class="o">&amp;&amp;</span> 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
<span class="k">ENTRYPOINT</span> <span class="p">[</span><span class="s2">&quot;/bin/k3s&quot;</span><span class="p">]</span>
<span class="k">CMD</span> <span class="p">[</span><span class="s2">&quot;agent&quot;</span><span class="p">]</span>
</code></pre></div>
<p>This <a href="cuda/Dockerfile">Dockerfile</a> is based on the <a href="https://github.com/rancher/k3s/blob/master/package/Dockerfile">K3S Dockerfile</a>.
<p>This <a href="cuda/Dockerfile">Dockerfile</a> is based on the <a href="https://github.com/rancher/k3s/blob/master/package/Dockerfile">K3s Dockerfile</a>.
The following changes are applied:</p>
<ol>
<li>Change the base images to Ubuntu 18.04 so the NVIDIA Container Runtime can be installed</li>
@ -1105,7 +1096,7 @@ The following changes are applied:</p>
<li>Add a manifest for the NVIDIA driver plugin for Kubernetes</li>
</ol>
<h3 id="configure-containerd">Configure containerd<a class="headerlink" href="#configure-containerd" title="Permanent link">&para;</a></h3>
<p>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 <a href="config.toml.tmpl">config.toml.tmpl</a> file. More information can be found on the <a href="https://rancher.com/docs/k3s/latest/en/advanced/#configuring-containerd">K3S site</a>.</p>
<p>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 <a href="config.toml.tmpl">config.toml.tmpl</a> file. More information can be found on the <a href="https://rancher.com/docs/k3s/latest/en/advanced/#configuring-containerd">K3s site</a>.</p>
<div class="highlight"><pre><span></span><code><span class="p">[</span><span class="nx">plugins</span><span class="p">.</span><span class="nx">opt</span><span class="p">]</span>
<span class="nx">path</span> <span class="p">=</span> <span class="s">&quot;{{ .NodeConfig.Containerd.Opt }}&quot;</span>
@ -1281,7 +1272,7 @@ kubectl logs cuda-vector-add
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">January 5, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/guides/exposing_services/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -867,18 +867,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -943,7 +931,7 @@
<h1 id="exposing-services">Exposing Services<a class="headerlink" href="#exposing-services" title="Permanent link">&para;</a></h1>
<h2 id="1-via-ingress-recommended">1. via Ingress (recommended)<a class="headerlink" href="#1-via-ingress-recommended" title="Permanent link">&para;</a></h2>
<p>In this example, we will deploy a simple nginx webserver deployment and make it accessible via ingress.
<p>In this example, we will deploy a simple nginx webserver deployment and make it accessible via ingress.<br />
Therefore, we have to create the cluster in a way, that the internal port 80 (where the <code>traefik</code> ingress controller is listening on) is exposed on the host system.</p>
<ol>
<li>
@ -952,11 +940,16 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh
<div class="admonition info">
<p class="admonition-title">Good to know</p>
<ul>
<li><code>--api-port 6550</code> is not required for the example to work. It&rsquo;s used to have <code>k3s</code>&lsquo;s API-Server listening on port 6550 with that port mapped to the host system.</li>
<li>the port-mapping construct <code>8081:80@loadbalancer</code> means
- map port <code>8081</code> from the host to port <code>80</code> on the container which matches the nodefilter <code>loadbalancer</code></li>
<li>the <code>loadbalancer</code> nodefilter matches only the <code>serverlb</code> that&rsquo;s deployed in front of a cluster&rsquo;s server nodes
- all ports exposed on the <code>serverlb</code> will be proxied to the same ports on all server nodes in the cluster</li>
<li><code>--api-port 6550</code> is not required for the example to work.<br />
It&rsquo;s used to have <code>k3s</code>&lsquo;s API-Server listening on port 6550 with that port mapped to the host system.</li>
<li>the port-mapping construct <code>8081:80@loadbalancer</code> means:<br />
&ldquo;map port <code>8081</code> from the host to port <code>80</code> on the container which matches the nodefilter <code>loadbalancer</code>&ldquo;<ul>
<li>the <code>loadbalancer</code> nodefilter matches only the <code>serverlb</code> that&rsquo;s deployed in front of a cluster&rsquo;s server nodes<ul>
<li>all ports exposed on the <code>serverlb</code> will be proxied to the same ports on all server nodes in the cluster</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</li>
@ -973,8 +966,8 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh
<p><code class="highlight">kubectl create service clusterip nginx --tcp<span class="o">=</span><span class="m">80</span>:80</code></p>
</li>
<li>
<p>Create an ingress object for it with <code class="highlight">kubectl apply -f</code>
<em>Note</em>: <code>k3s</code> deploys <a href="https://github.com/containous/traefik"><code>traefik</code></a> as the default ingress controller</p>
<p>Create an ingress object for it by copying the following manifest to a file and applying with <code class="highlight">kubectl apply -f thatfile.yaml</code></p>
<p><strong>Note</strong>: <code>k3s</code> deploys <a href="https://github.com/containous/traefik"><code>traefik</code></a> as the default ingress controller</p>
<div class="highlight"><pre><span></span><code><span class="c1"># apiVersion: networking.k8s.io/v1beta1 # for k3s &lt; v1.19</span>
<span class="nt">apiVersion</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">networking.k8s.io/v1</span>
<span class="nt">kind</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">Ingress</span>
@ -1002,16 +995,22 @@ Therefore, we have to create the cluster in a way, that the internal port 80 (wh
</ol>
<h2 id="2-via-nodeport">2. via NodePort<a class="headerlink" href="#2-via-nodeport" title="Permanent link">&para;</a></h2>
<ol>
<li>Create a cluster, mapping the port 30080 from agent-0 to localhost:8082<p><code class="highlight">k3d cluster create mycluster -p <span class="s2">&quot;8082:30080@agent[0]&quot;</span> --agents <span class="m">2</span></code></p>
<p>- <strong>Note</strong>: Kubernetes&rsquo; default NodePort range is <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"><code>30000-32767</code></a></p>
<p>- <strong>Note</strong>: You may as well expose the whole NodePort range from the very beginning, e.g. via <code>k3d cluster create mycluster --agents 3 -p "30000-32767:30000-32767@server[0]"</code> (See <a href="https://www.youtube.com/watch?v=5HaU6338lAk">this video from @portainer</a>)
- <strong>Warning</strong>: 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!</p>
</li>
</ol>
<li>
<p>Create a cluster, mapping the port <code>30080</code> from <code>agent-0</code> to <code>localhost:8082</code></p>
<p><code class="highlight">k3d cluster create mycluster -p <span class="s2">&quot;8082:30080@agent[0]&quot;</span> --agents <span class="m">2</span></code></p>
<ul>
<li><strong>Note 1</strong>: Kubernetes&rsquo; default NodePort range is <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"><code>30000-32767</code></a></li>
<li>
<p><strong>Note 2</strong>: You may as well expose the whole NodePort range from the very beginning, e.g. via <code>k3d cluster create mycluster --agents 3 -p "30000-32767:30000-32767@server[0]"</code> (See <a href="https://www.youtube.com/watch?v=5HaU6338lAk">this video from @portainer</a>)</p>
<ul>
<li><strong>Warning</strong>: 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!</li>
</ul>
<p>&hellip; (Steps 2 and 3 like above) &hellip;</p>
<ol>
</li>
</ul>
</li>
<li>
<p>Create a NodePort service for it with <code class="highlight">kubectl apply -f</code></p>
<p>Create a NodePort service for it by copying the following manifest to a file and applying it with <code class="highlight">kubectl apply -f</code></p>
<div class="highlight"><pre><span></span><code><span class="nt">apiVersion</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">v1</span>
<span class="nt">kind</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">Service</span>
<span class="nt">metadata</span><span class="p">:</span>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/guides/registries/">
<link rel="icon" href="../../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -955,18 +955,6 @@
<li class="md-nav__item">
<a href="../../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -1165,7 +1153,7 @@
</code></pre></div>
<h3 id="secure-registries">Secure registries<a class="headerlink" href="#secure-registries" title="Permanent link">&para;</a></h3>
<p>When using secure registries, the <a href="#registries-file"><code>registries.yaml</code> file</a> must include information about the certificates. For example, if you want to use images from the secure registry running at <code>https://my.company.registry</code>, you must first download a CA file valid for that server and store it in some well-known directory like <code>${HOME}/.k3d/my-company-root.pem</code>. </p>
<p>Then you have to mount the CA file in some directory in the nodes in the cluster and include that mounted file in a <code>configs</code> section in the <a href="#registries-file"><code>registries.yaml</code> file</a>.
<p>Then you have to mount the CA file in some directory in the nodes in the cluster and include that mounted file in a <code>configs</code> section in the <a href="#registries-file"><code>registries.yaml</code> file</a>.<br />
For example, if we mount the CA file in <code>/etc/ssl/certs/my-company-root.pem</code>, the <code>registries.yaml</code> will look like:</p>
<div class="highlight"><pre><span></span><code><span class="nt">mirrors</span><span class="p">:</span>
<span class="nt">my.company.registry</span><span class="p">:</span>
@ -1179,7 +1167,10 @@ For example, if we mount the CA file in <code>/etc/ssl/certs/my-company-root.pem
<span class="nt">ca_file</span><span class="p">:</span> <span class="s">&quot;/etc/ssl/certs/my-company-root.pem&quot;</span>
</code></pre></div>
<p>Finally, we can create the cluster, mounting the CA file in the path we specified in <code>ca_file</code>:</p>
<p><code class="highlight">k3d cluster create --volume <span class="s2">&quot;</span><span class="si">${</span><span class="nv">HOME</span><span class="si">}</span><span class="s2">/.k3d/my-registries.yaml:/etc/rancher/k3s/registries.yaml&quot;</span> --volume <span class="s2">&quot;</span><span class="si">${</span><span class="nv">HOME</span><span class="si">}</span><span class="s2">/.k3d/my-company-root.pem:/etc/ssl/certs/my-company-root.pem&quot;</span></code></p>
<div class="highlight"><pre><span></span><code>k3d cluster create <span class="se">\</span>
--volume <span class="s2">&quot;</span><span class="si">${</span><span class="nv">HOME</span><span class="si">}</span><span class="s2">/.k3d/my-registries.yaml:/etc/rancher/k3s/registries.yaml&quot;</span> <span class="se">\</span>
--volume <span class="s2">&quot;</span><span class="si">${</span><span class="nv">HOME</span><span class="si">}</span><span class="s2">/.k3d/my-company-root.pem:/etc/ssl/certs/my-company-root.pem&quot;</span>
</code></pre></div>
<h2 id="using-a-local-registry">Using a local registry<a class="headerlink" href="#using-a-local-registry" title="Permanent link">&para;</a></h2>
<h3 id="using-k3d-managed-registries">Using k3d-managed registries<a class="headerlink" href="#using-k3d-managed-registries" title="Permanent link">&para;</a></h3>
<div class="admonition info">
@ -1188,10 +1179,16 @@ For example, if we mount the CA file in <code>/etc/ssl/certs/my-company-root.pem
</div>
<h4 id="create-a-dedicated-registry-together-with-your-cluster">Create a dedicated registry together with your cluster<a class="headerlink" href="#create-a-dedicated-registry-together-with-your-cluster" title="Permanent link">&para;</a></h4>
<ol>
<li><code class="highlight">k3d cluster create mycluster --registry-create</code>: This creates your cluster <code>mycluster</code> together with a registry container called <code>k3d-mycluster-registry</code>
- k3d sets everything up in the cluster for containerd to be able to pull images from that registry (using the <code>registries.yaml</code> file)
- the port, which the registry is listening on will be mapped to a random port on your host system</li>
<li>Check the k3d command output or <code class="highlight">docker ps -f <span class="nv">name</span><span class="o">=</span>k3d-mycluster-registry</code> to find the exposed port (let&rsquo;s use <code>12345</code> here)</li>
<li>
<p><code class="highlight">k3d cluster create mycluster --registry-create</code>: This creates your cluster <code>mycluster</code> together with a registry container called <code>k3d-mycluster-registry</code></p>
<ul>
<li>k3d sets everything up in the cluster for containerd to be able to pull images from that registry (using the <code>registries.yaml</code> file)</li>
<li>the port, which the registry is listening on will be mapped to a random port on your host system</li>
</ul>
</li>
<li>
<p>Check the k3d command output or <code class="highlight">docker ps -f <span class="nv">name</span><span class="o">=</span>k3d-mycluster-registry</code> to find the exposed port (let&rsquo;s use <code>12345</code> here)</p>
</li>
<li>Pull some image (optional) <code class="highlight">docker pull alpine:latest</code>, re-tag it to reference your newly created registry <code class="highlight">docker tag alpine:latest k3d-mycluster-registry:12345/testimage:local</code> and push it <code class="highlight">docker push k3d-mycluster-registry:12345/testimage:local</code></li>
<li>Use kubectl to create a new pod in your cluster using that image to see, if the cluster can pull from the new registry: <code class="highlight">kubectl run --image k3d-mycluster-registry:12345/testimage:local testimage --command -- tail -f /dev/null</code> (creates a container that will not do anything but keep on running)</li>
</ol>
@ -1231,7 +1228,8 @@ Otherwise, it&rsquo;s installable using <code>sudo apt install libnss-myhostname
<li>push to your registry from your local development machine.</li>
<li>use images from that registry in <code>Deployments</code> in your k3d cluster.</li>
</ul>
<p>We will verify these two things for a local registry (located at <code>k3d-registry.localhost:12345</code>) 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&rsquo;s documentation for this).</p>
<p>We will verify these two things for a local registry (located at <code>k3d-registry.localhost:12345</code>) running in your development machine.<br />
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&rsquo;s documentation for this).</p>
<p>First, we can download some image (like <code>nginx</code>) and push it to our local registry with:</p>
<div class="highlight"><pre><span></span><code>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
</code></pre></div>
<p>Then you should check that the pod is running with <code>kubectl get pods -l "app=nginx-test-registry"</code>.</p>
<h2 id="configuring-registries-for-k3s-v091">Configuring registries for k3s &lt;= v0.9.1<a class="headerlink" href="#configuring-registries-for-k3s-v091" title="Permanent link">&para;</a></h2>
<p>k3s servers below v0.9.1 do not recognize the <code>registries.yaml</code> file as described in
the in the beginning, so you will need to embed the contents of that file in a <code>containerd</code> configuration file.
<p>k3s servers below v0.9.1 do not recognize the <code>registries.yaml</code> file as described in the in the beginning, so you will need to embed the contents of that file in a <code>containerd</code> configuration file.<br />
You will have to create your own <code>containerd</code> configuration file at some well-known path like <code>${HOME}/.k3d/config.toml.tmpl</code>, like this:</p>
<details class="registriesprev091"><summary>config.toml.tmpl</summary><div class="highlight"><pre><span></span><code><span class="c1"># Original section: no changes</span>
<span class="k">[plugins.opt]</span>
@ -1305,7 +1302,7 @@ You will have to create your own <code>containerd</code> configuration file at s
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">March 11, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/kubeconfig/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -872,18 +872,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -954,7 +942,7 @@
<h1 id="handling-kubeconfigs">Handling Kubeconfigs<a class="headerlink" href="#handling-kubeconfigs" title="Permanent link">&para;</a></h1>
<p>By default, k3d will update your default kubeconfig with your new cluster&rsquo;s details and set the current-context to it (can be disabled).
<p>By default, k3d will update your default kubeconfig with your new cluster&rsquo;s details and set the current-context to it (can be disabled).<br />
To get a kubeconfig set up for you to connect to a k3d cluster without this automatism, you can go different ways.</p>
<details class="question"><summary>What is the default kubeconfig?</summary><p>We determine the path of the used or default kubeconfig in two ways:</p>
<ol>
@ -964,35 +952,59 @@ To get a kubeconfig set up for you to connect to a k3d cluster without this auto
</details>
<h2 id="getting-the-kubeconfig-for-a-newly-created-cluster">Getting the kubeconfig for a newly created cluster<a class="headerlink" href="#getting-the-kubeconfig-for-a-newly-created-cluster" title="Permanent link">&para;</a></h2>
<ol>
<li>Create a new kubeconfig file <strong>after</strong> cluster creation
- <code class="highlight">k3d kubeconfig write mycluster</code>
- <em>Note:</em> this will create (or update) the file <code>$HOME/.k3d/kubeconfig-mycluster.yaml</code>
- <em>Tip:</em> Use it: <code class="highlight"><span class="nb">export</span> <span class="nv">KUBECONFIG</span><span class="o">=</span><span class="k">$(</span>k3d kubeconfig write mycluster<span class="k">)</span></code>
- <em>Note 2</em>: alternatively you can use <code class="highlight">k3d kubeconfig get mycluster &gt; some-file.yaml</code></li>
<li>Update your default kubeconfig <strong>upon</strong> cluster creation (DEFAULT)
- <code class="highlight">k3d cluster create mycluster --kubeconfig-update-default</code>
- <em>Note:</em> this won&rsquo;t switch the current-context (append <code>--kubeconfig-switch-context</code> to do so)</li>
<li>Update your default kubeconfig <strong>after</strong> cluster creation
- <code class="highlight">k3d kubeconfig merge mycluster --kubeconfig-merge-default</code>
- <em>Note:</em> this won&rsquo;t switch the current-context (append <code>--kubeconfig-switch-context</code> to do so)</li>
<li>Update a different kubeconfig <strong>after</strong> cluster creation
- <code class="highlight">k3d kubeconfig merge mycluster --output some/other/file.yaml</code>
- <em>Note:</em> this won&rsquo;t switch the current-context
- The file will be created if it doesn&rsquo;t exist</li>
<li>
<p>Create a new kubeconfig file <strong>after</strong> cluster creation</p>
<ul>
<li><code class="highlight">k3d kubeconfig write mycluster</code><ul>
<li><em>Note:</em> this will create (or update) the file <code>$HOME/.k3d/kubeconfig-mycluster.yaml</code></li>
<li><em>Tip:</em> Use it: <code class="highlight"><span class="nb">export</span> <span class="nv">KUBECONFIG</span><span class="o">=</span><span class="k">$(</span>k3d kubeconfig write mycluster<span class="k">)</span></code></li>
<li><em>Note 2</em>: alternatively you can use <code class="highlight">k3d kubeconfig get mycluster &gt; some-file.yaml</code></li>
</ul>
</li>
</ul>
</li>
<li>
<p>Update your default kubeconfig <strong>upon</strong> cluster creation (DEFAULT)</p>
<ul>
<li><code class="highlight">k3d cluster create mycluster --kubeconfig-update-default</code><ul>
<li><em>Note:</em> this won&rsquo;t switch the current-context (append <code>--kubeconfig-switch-context</code> to do so)</li>
</ul>
</li>
</ul>
</li>
<li>
<p>Update your default kubeconfig <strong>after</strong> cluster creation</p>
<ul>
<li><code class="highlight">k3d kubeconfig merge mycluster --kubeconfig-merge-default</code><ul>
<li><em>Note:</em> this won&rsquo;t switch the current-context (append <code>--kubeconfig-switch-context</code> to do so)</li>
</ul>
</li>
</ul>
</li>
<li>
<p>Update a different kubeconfig <strong>after</strong> cluster creation</p>
<ul>
<li><code class="highlight">k3d kubeconfig merge mycluster --output some/other/file.yaml</code><ul>
<li><em>Note:</em> this won&rsquo;t switch the current-context</li>
</ul>
</li>
<li>The file will be created if it doesn&rsquo;t exist</li>
</ul>
</li>
</ol>
<div class="admonition info">
<p class="admonition-title">Switching the current context</p>
<p>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.
<p>None of the above options switch the current-context by default.<br />
This is intended to be least intrusive, since the current-context has a global effect.<br />
You can switch the current-context directly with the <code>kubeconfig merge</code> command by adding the <code>--kubeconfig-switch-context</code> flag.</p>
</div>
<h2 id="removing-cluster-details-from-the-kubeconfig">Removing cluster details from the kubeconfig<a class="headerlink" href="#removing-cluster-details-from-the-kubeconfig" title="Permanent link">&para;</a></h2>
<p><code class="highlight">k3d cluster delete mycluster</code> will always remove the details for <code>mycluster</code> from the default kubeconfig.
It will also delete the respective kubeconfig file in <code>$HOME/.k3d/</code> if it exists.</p>
<h2 id="handling-multiple-clusters">Handling multiple clusters<a class="headerlink" href="#handling-multiple-clusters" title="Permanent link">&para;</a></h2>
<p><code>k3d kubeconfig merge</code> let&rsquo;s you specify one or more clusters via arguments <em>or</em> all via <code>--all</code>.
All kubeconfigs will then be merged into a single file if <code>--kubeconfig-merge-default</code> or <code>--output</code> is specified.
If none of those two flags was specified, a new file will be created per cluster and the merged path (e.g. <code>$HOME/.k3d/kubeconfig-cluster1.yaml:$HOME/.k3d/cluster2.yaml</code>) will be returned.
<p><code>k3d kubeconfig merge</code> let&rsquo;s you specify one or more clusters via arguments <em>or</em> all via <code>--all</code>.<br />
All kubeconfigs will then be merged into a single file if <code>--kubeconfig-merge-default</code> or <code>--output</code> is specified.<br />
If none of those two flags was specified, a new file will be created per cluster and the merged path (e.g. <code>$HOME/.k3d/kubeconfig-cluster1.yaml:$HOME/.k3d/cluster2.yaml</code>) will be returned.<br />
Note, that with multiple cluster specified, the <code>--kubeconfig-switch-context</code> flag will change the current context to the cluster which was last in the list.</p>
@ -1002,7 +1014,7 @@ Note, that with multiple cluster specified, the <code>--kubeconfig-switch-contex
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">January 5, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

@ -14,7 +14,7 @@
<link rel="canonical" href="https://k3d.io/usage/multiserver/">
<link rel="icon" href="../../static/img/favicons_black_blue/favicon.png">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<meta name="generator" content="mkdocs-1.2.1, mkdocs-material-7.1.7">
@ -673,8 +673,8 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#embedded-dqlite" class="md-nav__link">
Embedded dqlite
<a href="#embedded-etcd-old-dqlite" class="md-nav__link">
Embedded etcd (old: dqlite)
</a>
</li>
@ -865,18 +865,6 @@
<li class="md-nav__item">
<a href="../../faq/v1vsv3-comparison/" class="md-nav__link">
Feature Comparison: v1 vs. v3
</a>
</li>
</ul>
</nav>
</li>
@ -909,8 +897,8 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#embedded-dqlite" class="md-nav__link">
Embedded dqlite
<a href="#embedded-etcd-old-dqlite" class="md-nav__link">
Embedded etcd (old: dqlite)
</a>
</li>
@ -945,19 +933,19 @@
<p>For the best results (and less unexpected issues), choose 1, 3, 5, &hellip; server nodes.
At least 2 cores and 4GiB of RAM are recommended.</p>
</div>
<h2 id="embedded-dqlite">Embedded dqlite<a class="headerlink" href="#embedded-dqlite" title="Permanent link">&para;</a></h2>
<p>Create a cluster with 3 server nodes using k3s&rsquo; embedded dqlite database.
<h2 id="embedded-etcd-old-dqlite">Embedded etcd (old: dqlite)<a class="headerlink" href="#embedded-etcd-old-dqlite" title="Permanent link">&para;</a></h2>
<p>Create a cluster with 3 server nodes using k3s&rsquo; embedded etcd (old: dqlite) database.
The first server to be created will use the <code>--cluster-init</code> flag and k3d will wait for it to be up and running before creating (and connecting) the other server nodes.</p>
<div class="highlight"><pre><span></span><code> k3d cluster create multiserver --servers <span class="m">3</span>
<div class="highlight"><pre><span></span><code>k3d cluster create multiserver --servers <span class="m">3</span>
</code></pre></div>
<h2 id="adding-server-nodes-to-a-running-cluster">Adding server nodes to a running cluster<a class="headerlink" href="#adding-server-nodes-to-a-running-cluster" title="Permanent link">&para;</a></h2>
<p>In theory (and also in practice in most cases), this is as easy as executing the following command:</p>
<div class="highlight"><pre><span></span><code> k3d node create newserver --cluster multiserver --role server
<div class="highlight"><pre><span></span><code>k3d node create newserver --cluster multiserver --role server
</code></pre></div>
<div class="admonition important">
<p class="admonition-title">There&rsquo;s a trap!</p>
<p>If your cluster was initially created with only a single server node, then this will fail.
That&rsquo;s because the initial server node was not started with the <code>--cluster-init</code> flag and thus is not using the dqlite backend.</p>
<p>If your cluster was initially created with only a single server node, then this will fail.<br />
That&rsquo;s because the initial server node was not started with the <code>--cluster-init</code> flag and thus is not using the etcd (old: dqlite) backend.</p>
</div>
@ -967,7 +955,7 @@ That&rsquo;s because the initial server node was not started with the <code>--cl
<div class="md-source-date">
<small>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">February 9, 2021</span>
Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 9, 2021</span>
</small>

Loading…
Cancel
Save