{"id":23180948,"url":"https://github.com/replicatedhq/sbctl","last_synced_at":"2025-08-18T13:33:25.232Z","repository":{"id":38299325,"uuid":"455670344","full_name":"replicatedhq/sbctl","owner":"replicatedhq","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-12T14:47:09.000Z","size":677,"stargazers_count":41,"open_issues_count":7,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-09-13T03:05:37.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/replicatedhq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-04T19:24:19.000Z","updated_at":"2024-09-03T20:42:20.000Z","dependencies_parsed_at":"2023-02-01T19:17:00.315Z","dependency_job_id":"db42ffb3-11ae-49aa-98c7-74eff7485bfb","html_url":"https://github.com/replicatedhq/sbctl","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replicatedhq%2Fsbctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replicatedhq%2Fsbctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replicatedhq%2Fsbctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replicatedhq%2Fsbctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/replicatedhq","download_url":"https://codeload.github.com/replicatedhq/sbctl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230238268,"owners_count":18194988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-18T08:13:55.720Z","updated_at":"2025-08-18T13:33:25.219Z","avatar_url":"https://github.com/replicatedhq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Command line tool for examining K8s resources in Troubleshoot's support bundles\n\n### How to install (Mac):\n\nDownload the release binary and untar it to a directory in your `PATH` (you'll need to enter your `sudo` password for the last `mv`):\n\n#### Intel CPU / `amd64`\n\n```\ncurl -LO https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_darwin_amd64.tar.gz\ntar -xzf sbctl_darwin_amd64.tar.gz -C /tmp sbctl\nrm -f sbctl_darwin_amd64.tar.gz\nsudo mv /tmp/sbctl /usr/local/bin/\n```\n\n#### Apple M1 CPU / `arm64`\n\n```\ncurl -LO https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_darwin_arm64.tar.gz\ntar -xzf sbctl_darwin_arm64.tar.gz -C /tmp sbctl\nrm -f sbctl_darwin_arm64.tar.gz\nsudo mv /tmp/sbctl /usr/local/bin/\n```\n\nRestart your shell and proceed to \"How to Use\".\n\n### How to Use:\n\n#### Check the version\n```\nsbctl version\n```\nDisplays the version information in the format:\n```\nsbctl version [version-number]\ngo version [go-version-number]\n```\n\n#### Start server in foreground\nStart the local API server using a support bundle and then run the `export` command that comes up to make kubectl target your support bundles API server\n\n```\nsbctl serve /Users/username/Downloads/support-bundle-XXXX-XX-XX\n\nServer is running\n\nexport KUBECONFIG=/var/folders/g2/XXXXXXXXXXX/T/local-kubeconfig-XXXXX\n```\n\n#### Start sbctl shell\nStart the local API server and create a shell that has `KUBECONFIG` set. With this you can use `kubectl` commands immediately without the need to run `export`. In this example we also show how to download the support bundle from a remote location. We can choose to use `--token=\u003ctoken\u003e` cli option to pass in an auth token or export `SBCTL_TOKEN=\u003ctoken\u003e`. In this example I have `SBCTL_TOKEN` in the environment\n\n```\nexport SBCTL_TOKEN=\u003ctoken\u003e\n```\n\nNow launch the shell\n```\nsbctl shell https://vendor.replicated.com/troubleshoot/analyze/2024-08-02@00:01\nAPI server logs will be written to /var/folders/19/bp6c9chj0sgcpcxmxxl69s040000gn/T/sbctl-server-logs-1413638036\nDownloading bundle\nBundle extracted to /var/folders/19/bp6c9chj0sgcpcxmxxl69s040000gn/T/sbctl-2353785059\nStarting new shell with KUBECONFIG. Press Ctl-D when done to end the shell and the sbctl server\n```\n\nUsing `kubectl` should now auth using the generated kubeconfig file.  When done, CTRL^C to shut down the API server.\n\n```\n$ kubectl get ns\n\nNAME                          STATUS   AGE\nkube-system                   Active   204d\ndefault                       Active   204d\nkube-public                   Active   204d\nkube-node-lease               Active   204d\ndocker-registry               Active   204d\nschemahero-system             Active   199d\nvelero                        Active   135d\npostgres-test                 Active   22d\nredis-test                    Active   22d\nnginx-test                    Active   22d\ntest                          Active   10d\n```\n\n```\n$ kubectl get pods -n kube-system\nNAME                                      READY   STATUS      RESTARTS       AGE\nhelm-install-traefik-crd-jk29f            0/1     Completed   0              204d\nhelm-install-traefik-nf68z                0/1     Completed   1 (204d ago)   204d\nsvclb-traefik-clk94                       2/2     Running     2 (165d ago)   204d\nmetrics-server-86cbb8457f-g9kdc           1/1     Running     1 (165d ago)   204d\nlocal-path-provisioner-5ff76fc89d-cgpdv   1/1     Running     2 (86d ago)    204d\ncoredns-7448499f4d-x8fw9                  1/1     Running     1 (165d ago)   204d\ntraefik-97b44b794-mhvsh                   1/1     Running     1 (165d ago)   204d\n```\n\n```\n$ kubectl describe pod kotsadm-75d9ff6f44-ssrx6 \nName:         kotsadm-75d9ff6f44-ssrx6\nNamespace:    default\nPriority:     0\nNode:         my-node/***HIDDEN***\nStart Time:   Tue, 01 Feb 2022 18:31:36 -0800\nLabels:       app=kotsadm\n              app.kubernetes.io/name=kotsadm\n              kots.io/backup=velero\n              kots.io/kotsadm=true\n              pod-template-hash=75d9ff6f44\n              skaffold.dev/run-id=ca77ed45-8a57-44af-ac0f-ec1931c57841\nAnnotations:  backup.velero.io/backup-volumes: backup\n              pre.hook.backup.velero.io/command:\n                [\"/bin/bash\", \"-c\", \"PGPASSWORD=password pg_dump -U kotsadm -h kotsadm-postgres \u003e /backup/kotsadm-postgres.sql\"]\n              pre.hook.backup.velero.io/timeout: 3m\nStatus:       Running\nIP:           ***HIDDEN***\nIPs:\n  IP:           ***HIDDEN***\nControlled By:  ReplicaSet/kotsadm-75d9ff6f44\nContainers:\n  kotsadm:\n    Container ID:   containerd://84288b23eaf84112248eea8ec2f94a0f8f231036a46715c936c741154173271d\n    Image:          localhost:32000/kotsadm:v1.60.0-26-g4e016d2ff-dirty@sha256:6c2f016f1e99a1f8b2129eb6b93ba59526118bdcada8c8e73f051db4123ff683\n    Image ID:       localhost:32000/kotsadm@sha256:6c2f016f1e99a1f8b2129eb6b93ba59526118bdcada8c8e73f051db4123ff683\n    Ports:          40000/TCP, 3000/TCP, 9229/TCP\n    Host Ports:     0/TCP, 0/TCP, 0/TCP\n    State:          Running\n      Started:      Tue, 01 Feb 2022 18:31:39 -0800\n    Ready:          True\n    Restart Count:  0\n    Limits:\n      cpu:     1\n      memory:  2Gi\n    Requests:\n      cpu:     100m\n      memory:  100Mi\n    Environment:\n      POSTGRES_URI:               \u003cset to the key 'uri' in secret 'kotsadm-postgres'\u003e  Optional: false\n      S3_BUCKET_NAME:             shipbucket\n      S3_ENDPOINT:                http://kotsadm-s3:4569/\n      S3_ACCESS_KEY_ID:           ***HIDDEN***\n      S3_SECRET_ACCESS_KEY:       ***HIDDEN***\n      S3_BUCKET_ENDPOINT:         true\n      DEX_PGPASSWORD:             \u003cset to the key 'PGPASSWORD' in secret 'kotsadm-dex-postgres'\u003e  Optional: false\n      KOTSADM_LOG_LEVEL:          debug\n      DISABLE_SPA_SERVING:        1\n      KOTSADM_TARGET_NAMESPACE:   test\n      AUTO_CREATE_CLUSTER:        1\n      AUTO_CREATE_CLUSTER_NAME:   microk8s\n      AUTO_CREATE_CLUSTER_TOKEN:  ***HIDDEN***\n      POD_NAMESPACE:              default (v1:metadata.namespace)\n      SHARED_PASSWORD_BCRYPT:     ***HIDDEN***\n      SESSION_KEY:                this-is-not-too-secret\n      API_ENCRYPTION_KEY:         IvWItkB8+ezMisPjSMBknT1PdKjBx7Xc/txZqOP8Y2Oe7+Jy\n      REPLICATED_API_ENDPOINT:    http://replicated-app:3000\n      API_ENDPOINT:               http://kotsadm:3000\n      API_ADVERTISE_ENDPOINT:     http://***HIDDEN***:30000\n      KOTSADM_ENV:                dev\n      ENABLE_WEB_PROXY:           1\n      KURL_PROXY_TLS_CERT_PATH:   /etc/kurl-proxy/ca/tls.crt\n      KOTS_INSTALL_ID:            dev-1pu4oeY162e2pbLpK4JubK6hxrX\n      AIRGAP_UPLOAD_PARALLELISM:  3\n      POD_OWNER_KIND:             deployment\n      DEBUG:                      false\n    Mounts:\n      /backup from backup (rw)\n      /etc/kubernetes/pki/kubelet from kubelet-client-cert (rw)\n      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-zfw8v (ro)\nConditions:\n  Type              Status\n  Initialized       True \n  Ready             True \n  ContainersReady   True \n  PodScheduled      True \nVolumes:\n  backup:\n    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)\n    Medium:     Memory\n    SizeLimit:  1Gi\n  kubelet-client-cert:\n    Type:        Secret (a volume populated by a Secret)\n    SecretName:  kubelet-client-cert\n    Optional:    true\n  init-dex-db:\n    Type:      ConfigMap (a volume populated by a ConfigMap)\n    Name:      init-dex-db\n    Optional:  false\n  kube-api-access-zfw8v:\n    Type:                    Projected (a volume that contains injected data from multiple sources)\n    TokenExpirationSeconds:  3607\n    ConfigMapName:           kube-root-ca.crt\n    ConfigMapOptional:       \u003cnil\u003e\n    DownwardAPI:             true\nQoS Class:                   Burstable\nNode-Selectors:              \u003cnone\u003e\nTolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s\n                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s\n```\n\n\n### Interactive:\n\nStart the interactive shell\n```\n$ sbctl shell -s ~/Downloads/support-bundle-2022-02-03T23_22_37\nbash-5.0$\n```\n\nRun `kubectl` commands at the prompt.  When done, type `exit`.\n\n```\nbash-5.0$ kubectl get nodes\nNAME                    STATUS   ROLES                  AGE     VERSION\ntroubleshoot-demo-001   Ready    control-plane,master   2d22h   v1.23.5\ntroubleshoot-demo-002   Ready    \u003cnone\u003e                 2d21h   v1.23.5\ntroubleshoot-demo-003   Ready    \u003cnone\u003e                 2d21h   v1.23.5\nbash-5.0$ exit\nexit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplicatedhq%2Fsbctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freplicatedhq%2Fsbctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplicatedhq%2Fsbctl/lists"}