id = "kubectl" name = "kubectl" homepage = "https://kubernetes.io/docs/reference/kubectl/" description = "The Kubernetes command line tool, pointed at whichever cluster its kubeconfig context names." icon = "theSVG:kubernetes" executables = ["kubectl"] [dotfiles] # kubectl(1) and https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/ # — $KUBECONFIG, defaulting to ~/.kube/config. paths = ["~/.kube/config"] exclude = ["~/.kube/cache/", "~/.kube/http-cache/"] # The kubeconfig is not a whole-file secret: cluster endpoints, contexts and # namespaces are exactly what you want on the other machine. Only the # per-user credentials come out. secret = [] [[dotfiles.secret_paths]] file = "~/.kube/config" format = "yaml" match = { key_path = ["users.*.user.token", "users.*.user.client-key-data", "users.*.user.password"] } # Which cluster this machine is pointed at is a property of the machine, not # of the config you want mirrored everywhere. The user selected it and will # want to see it when restoring this box, so it is kept for this device alone. [[dotfiles.machine_lines]] file = "~/.kube/config" format = "yaml" match = { key_path = ["current-context"] } scope = "backup" [commands] format = 1 label = "kubectl" description = "Common read-only jobs: get resources and read pod logs. Cluster-changing commands are left out." quality = "ai-draft" base = "fig:kubectl" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/kubectl.ts" license = "MIT" [[commands.field]] id = "namespace" label = "Namespace" type = "string" option = ["-n", "--namespace"] sources = ["fig"] [[commands.group]] id = "basic" label = "Basic" fields = ["namespace"] [[commands.subcommand]] path = ["get"] label = "Get resources" description = "List or fetch resources. Watch, templates and raw requests are left out." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/kubectl.ts" license = "MIT" [[commands.subcommand.field]] id = "resource" label = "Resource type or TYPE/NAME" type = "string" position = 0 suggestions = [{ value = "pods", label = "Pods" }, { value = "deployments", label = "Deployments" }, { value = "services", label = "Services" }, { value = "nodes", label = "Nodes" }, { value = "namespaces", label = "Namespaces" }] sources = ["fig"] [[commands.subcommand.field]] id = "output" label = "Output format" type = "string" option = ["-o", "--output"] suggestions = [{ value = "wide", label = "wide" }, { value = "yaml", label = "YAML" }, { value = "json", label = "JSON" }, { value = "name", label = "name" }] sources = ["fig"] [[commands.subcommand.field]] id = "selector" label = "Label selector" type = "string" option = ["-l", "--selector"] sources = ["fig"] [[commands.subcommand.field]] id = "all_namespaces" label = "All namespaces" type = "boolean" option = ["-A", "--all-namespaces"] sources = ["fig"] [[commands.subcommand.field]] id = "show_labels" label = "Show labels" type = "boolean" option = ["--show-labels"] sources = ["fig"] [[commands.subcommand.field]] id = "watch" label = "Watch for changes" type = "boolean" option = ["-w", "--watch"] sources = ["fig"] [[commands.subcommand.task]] id = "list-all" label = "List across namespaces" set = { all_namespaces = [true] } fields = ["resource", "all_namespaces", "output"] required = ["resource"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["resource", "output", "selector", "all_namespaces", "show_labels", "watch"] [[commands.subcommand]] path = ["logs"] label = "Read pod logs" [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/kubectl.ts" license = "MIT" [[commands.subcommand.field]] id = "target" label = "Pod or TYPE/NAME" type = "string" position = 0 sources = ["fig"] [[commands.subcommand.field]] id = "container" label = "Container" type = "string" option = ["-c", "--container"] sources = ["fig"] [[commands.subcommand.field]] id = "follow" label = "Follow" type = "boolean" option = ["-f", "--follow"] sources = ["fig"] [[commands.subcommand.field]] id = "tail" label = "Last N lines" type = "integer" option = ["--tail"] sources = ["fig"] [[commands.subcommand.field]] id = "since" label = "Since (5s, 2m, 3h)" type = "string" option = ["--since"] sources = ["fig"] [[commands.subcommand.field]] id = "previous" label = "Previous container instance" type = "boolean" option = ["-p", "--previous"] sources = ["fig"] [[commands.subcommand.field]] id = "timestamps" label = "Timestamps" type = "boolean" option = ["--timestamps"] sources = ["fig"] [[commands.subcommand.task]] id = "tail" label = "Follow recent logs" set = { follow = [true], tail = [100] } fields = ["target", "follow", "tail", "container"] required = ["target"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["target", "container", "follow", "tail", "since", "previous", "timestamps"]