{"id":21311765,"url":"https://github.com/actions-hub/kubectl","last_synced_at":"2026-05-13T04:01:07.695Z","repository":{"id":38272370,"uuid":"211142921","full_name":"actions-hub/kubectl","owner":"actions-hub","description":"GitHub Action for interacting with kubectl (k8s)","archived":false,"fork":false,"pushed_at":"2025-04-24T00:53:10.000Z","size":43,"stargazers_count":140,"open_issues_count":6,"forks_count":72,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T01:04:03.755Z","etag":null,"topics":["github-action","k8s","kubectl","kubernetes"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/kuberentes-k8s-cli-kubectl","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actions-hub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2019-09-26T17:16:52.000Z","updated_at":"2025-04-29T14:56:32.000Z","dependencies_parsed_at":"2024-01-18T01:59:18.846Z","dependency_job_id":"a7b59109-3d9b-4aca-bd36-2882876a8241","html_url":"https://github.com/actions-hub/kubectl","commit_stats":{"total_commits":66,"total_committers":11,"mean_commits":6.0,"dds":0.2272727272727273,"last_synced_commit":"7575bf567c839756993578984fa5f04ab0cae1a1"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-hub%2Fkubectl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-hub%2Fkubectl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-hub%2Fkubectl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-hub%2Fkubectl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions-hub","download_url":"https://codeload.github.com/actions-hub/kubectl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448578,"owners_count":22072764,"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":["github-action","k8s","kubectl","kubernetes"],"created_at":"2024-11-21T17:19:58.023Z","updated_at":"2026-05-13T04:01:07.604Z","avatar_url":"https://github.com/actions-hub.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubectl\n\n[![Preview](https://serhiy.s3.eu-central-1.amazonaws.com/Github_repo/kubectl/logo.png)](https://cloud.google.com)\n\nGitHub Action for interacting with kubectl ([k8s](https://kubernetes.io))\n\n## Usage\nTo use kubectl put this step into your workflow:\n\n### Authorization with config file\n```yaml\n- uses: actions-hub/kubectl@master\n  env:\n    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}\n  with:\n    args: get pods\n```\n\n### Authorization with credentials\n```yaml\n- uses: actions-hub/kubectl@master\n  env:\n    KUBE_HOST: ${{ secrets.KUBE_HOST }}\n    KUBE_CERTIFICATE: ${{ secrets.KUBE_CERTIFICATE }}\n    KUBE_USERNAME: ${{ secrets.KUBE_USERNAME }}\n    KUBE_PASSWORD: ${{ secrets.KUBE_PASSWORD }}\n  with:\n    args: get pods\n```\n\n### Authorization with a bearer token\n```yaml\n- uses: actions-hub/kubectl@master\n  env:\n    KUBE_HOST: ${{ secrets.KUBE_HOST }}\n    KUBE_CERTIFICATE: ${{ secrets.KUBE_CERTIFICATE }}\n    KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}\n  with:\n    args: get pods\n```\n\n### Using kubectl ouput\n```yaml\n  - run: echo \"EXPECTED_NAMESPACE=namespace/$NAMESPACE\" \u003e\u003e $GITHUB_ENV\n  - name: 🛂 Check namespace exists\n    uses: actions-hub/kubectl@master\n    with:\n      redirect-to: NAMESPACE_EXIST\n      args: get namespace ${{ env.NAMESPACE }} -o name --ignore-not-found\n\n  - name: 🛡️ Preserve secret WEBAPP_TLS\n    if: env.NAMESPACE_EXIST == env.EXPECTED_NAMESPACE\n    uses: actions-hub/kubectl@master\n    with:\n      redirect-to: WEBAPP_TLS\n      args: get secret webapp-tls -n ${{ env.NAMESPACE }} -o yaml\n```\n\n## Environment variables\nAll these variables need to authorize to kubernetes cluster.  \nI recommend using secrets for this.\n\n### KUBECONFIG file\nFirst options its to use [kubeconfig file](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).  \n\nFor this method `KUBE_CONFIG` required.  \nYou can find it: `cat $HOME/.kube/config | base64 `.\n\nOptionally you can switch the [context](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) (the cluster) if you have few in kubeconfig file. Passing specific context to `KUBE_CONTEXT`. To see the list of available contexts do: `kubectl config get-contexts`.\n\n| Variable | Type |\n| --- | --- |\n| KUBE_CONFIG | string (base64) |\n| KUBE_CONTEXT | string |\n\n### KUBECONFIG file\nAnother way to authenticate in the cluster is [HTTP basic auth](https://kubernetes.io/docs/reference/access-authn-authz/authentication/).\n  \nFor this you need to pass:\n- host (IP only, without protocol)\n- username\n- password\n- cluster CA certificate\n\n| Variable | Type |\n| --- | --- |\n| KUBE_HOST | string |\n| KUBE_USERNAME | string |\n| KUBE_PASSWORD | string |\n| KUBE_CERTIFICATE | string |\n\n## Example\n```yaml\nname: Get pods\non: [push]\n\njobs:\n  deploy:\n    name: Deploy\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions-hub/kubectl@master\n        env:\n          KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}\n        with:\n          args: get pods\n```\n\n```yaml\nname: Get pods\non: [push]\n\njobs:\n  deploy:\n    name: Deploy\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions-hub/kubectl@master\n        env:\n          KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}\n\n      - uses: actions-hub/kubectl@master\n        with:\n          args: get pods\n```\n\n## Versions\nIf you need a specific version of kubectl, make a PR with a specific version number.\nAfter accepting PR the new release will be created.   \nTo use a specific version of kubectl use:\n\n```yaml\n- uses: actions-hub/kubectl@1.14.3\n  env:\n    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}\n  with:\n    args: get pods\n```\n\n## Licence\n[MIT License](https://github.com/actions-hub/kubectl/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-hub%2Fkubectl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions-hub%2Fkubectl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-hub%2Fkubectl/lists"}