Skip to content

docs: use default kubeconfig with k3s context name - #28

Merged
xnoto merged 1 commit into
mainfrom
docs/k3s-kubeconfig
Sep 13, 2026
Merged

xnoto merged 1 commit into
mainfrom
docs/k3s-kubeconfig

Conversation

@xnoto

@xnoto xnoto commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What

Updates the access section of KUBECTL.md: local kubectl access now standardizes on the default kubeconfig (~/.kube/config) with a context named k3s, instead of a dedicated per-cluster kubeconfig file.

Why

  • Simpler onboarding: one merged context list, no KUBECONFIG juggling or shell exports.
  • The context name is purely client-side — the apiserver authenticates the Dex-issued token's email/groups claims (provisioned in cloud-init/k3s/cloud_init.cfg), so renaming has no cluster or state impact.

Impact

  • Docs-only change to KUBECTL.md; no OpenTofu, cloud-init, or manifest changes. Break-glass and tunnel-recovery sections are unaffected (they concern the node-local admin kubeconfig, not workstation context naming).

Follow-up

  • kustomize-cluster still documents the old pattern in its README ### kubectl access section and docs/kubeconfig.example.yaml (dedicated ~/.kube/makeitworkcloud-k3s.yaml, context makeitworkcloud-k3s). KUBECTL.md links there for the OIDC flow, so a companion PR is needed to align that repo.

Local access now standardizes on the default kubeconfig (~/.kube/config)
with a context named k3s instead of a dedicated per-cluster kubeconfig
file. The context name is client-side only; the apiserver authenticates
the Dex-issued token's email/groups claims, so this has no cluster or
state impact.
@xnoto
xnoto requested a review from a team as a code owner September 13, 2026 03:22
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown

OpenTofu Test

OpenTofu test passed.

View the workflow run.

View run output
Terraform validate.......................................................Passed
Terraform validate with tflint...........................................Passed
Checkov..................................................................Passed
Terraform fmt............................................................Passed
Terraform docs...........................................................Passed
Detect hardcoded secrets.................................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check vcs permalinks.....................................................Passed
detect destroyed symlinks................................................Passed
detect private key.......................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
don't commit to branch..................................................Skipped
check for added large files..............................................Passed

@github-actions

Copy link
Copy Markdown

OpenTofu Plan

OpenTofu plan passed.

View the workflow run.

View run output
OpenTofu will perform the following actions:

  # module.k3s.libvirt_cloudinit_disk.commoninit will be created
  + resource "libvirt_cloudinit_disk" "commoninit" {
      + id             = (known after apply)
      + meta_data      = <<-EOT
            instance-id: k3s
            local-hostname: k3s
        EOT
      + name           = "k3s_commoninit"
      + network_config = <<-EOT
            version: 2
            ethernets:
              enp1s0:
                dhcp4: true
              enp2s0:
                dhcp4: false
                addresses:
                  - 192.168.102.2/24
        EOT
      + path           = (known after apply)
      + size           = (known after apply)
      + user_data      = (sensitive value)
    }

  # module.runner.libvirt_cloudinit_disk.commoninit will be created
  + resource "libvirt_cloudinit_disk" "commoninit" {
      + id             = (known after apply)
      + meta_data      = <<-EOT
            instance-id: runner
            local-hostname: runner
        EOT
      + name           = "runner_commoninit"
      + network_config = (sensitive value)
      + path           = (known after apply)
      + size           = (known after apply)
      + user_data      = (sensitive value)
    }

Plan: 2 to add, 0 to change, 0 to destroy.
OpenTofu will perform the following actions:

  # module.k3s.libvirt_cloudinit_disk.commoninit will be created
  + resource "libvirt_cloudinit_disk" "commoninit" {
      + id             = (known after apply)
      + meta_data      = <<-EOT
            instance-id: k3s
            local-hostname: k3s
        EOT
      + name           = "k3s_commoninit"
      + network_config = <<-EOT
            version: 2
            ethernets:
              enp1s0:
                dhcp4: true
              enp2s0:
                dhcp4: false
                addresses:
                  - 192.168.102.2/24
        EOT
      + path           = (known after apply)
      + size           = (known after apply)
      + user_data      = (sensitive value)
    }

  # module.runner.libvirt_cloudinit_disk.commoninit will be created
  + resource "libvirt_cloudinit_disk" "commoninit" {
      + id             = (known after apply)
      + meta_data      = <<-EOT
            instance-id: runner
            local-hostname: runner
        EOT
      + name           = "runner_commoninit"
      + network_config = (sensitive value)
      + path           = (known after apply)
      + size           = (known after apply)
      + user_data      = (sensitive value)
    }

Plan: 2 to add, 0 to change, 0 to destroy.

@xnoto
xnoto merged commit ca7d8ce into main Sep 13, 2026
4 checks passed
@xnoto
xnoto deleted the docs/k3s-kubeconfig branch September 13, 2026 03:25
xnoto added a commit to makeitworkcloud/kustomize-cluster that referenced this pull request Sep 13, 2026
## What

Aligns kubectl onboarding with the pattern shipped in
makeitworkcloud/tfroot-libvirt#28:

- **`docs/kubeconfig.example.yaml`**: context renamed
`makeitworkcloud-k3s` → `k3s`; `current-context` dropped so the file is
a safe *merge fragment* (cannot hijack an existing default context).
- **`README.md`** `### kubectl access`: replaces the dedicated
`~/.kube/makeitworkcloud-k3s.yaml` flow with a flatten-merge into the
default `~/.kube/config` (backup + `0600` preserved), and updates
verification commands to `--context k3s` / `--context=k3s`.

## Why

- One merged context list; no `KUBECONFIG` exports or per-cluster files.
- Context name is client-side only — the apiserver authenticates Dex
token `email`/`groups` claims. No cluster impact.

## Validation

Docs-only; no manifests, Applications, or secrets touched — Argo CD sync
scope unaffected. The documented merge and verification commands were
executed against a scratch kubeconfig: merge adds `k3s` alongside
existing contexts, preserves `current-context`, and resolves
`https://api.makeitwork.cloud` + `makeitworkcloud-oidc`. The same flow
was applied to a real workstation config and verified with a live
`kubectl --context=k3s auth whoami` (Dex OIDC, `makeitworkcloud:admins`
group).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant