Skip to content

Latest commit

 

History

History
48 lines (47 loc) · 2.04 KB

kubernetes.md

File metadata and controls

48 lines (47 loc) · 2.04 KB

Kubernetes (k8s)

  • Easiest way to set up a local single node cluster is via one of the following:
  • Add aliases to ~/.bashrc or ~/.zshrc
    # k8s
    alias k="kubectl"
    alias kc="kubectl config use-context"
    alias kns='kubectl config set-context --current --namespace'
    alias kgns="kubectl config view --minify --output 'jsonpath={..namespace}' | xargs printf '%s\n'"
    KUBECONFIG="$HOME/.kube/config:$HOME/.kube/kubeconfig:$HOME/.kube/k3s.yaml"
  • CLI/TUI (terminal user interface) management of k8s
    • k9s
      • Built-in help: type ?
      • Main Screen: :pod Main screen
      • Describe a pod: d Describe a pod
      • Delete a pod:
        • ctrl-d
        • Replicas rebuild Delete a pod
      • Remove resource (permanent)
        • :deploy
        • ctrl-d Remove resource
  • POC
    git clone https://github.com/jwsy/simplest-k8s.git
    k config get-contexts                    # should have `rancher-desktop` selected
    kc rancher-desktop                       # switch to rancher context if not
    k create namespace simplest-k8s
    k apply -n simplest-k8s -f simplest-k8s
    k delete -n simplest-k8s -f simplest-k8s
    k delete namespace simplest-k8s