{"id":13533802,"url":"https://github.com/machine-learning-apps/gke-kubeconfig","last_synced_at":"2025-04-01T22:30:40.326Z","repository":{"id":99791834,"uuid":"207398897","full_name":"machine-learning-apps/gke-kubeconfig","owner":"machine-learning-apps","description":"GitHub Action that Fetches Kubeconfig From GKE and saves to `$GITHUB_WORKSPACE/.kube/config`","archived":true,"fork":false,"pushed_at":"2019-11-24T01:18:32.000Z","size":32,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T20:33:27.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/machine-learning-apps.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}},"created_at":"2019-09-09T20:31:07.000Z","updated_at":"2022-12-09T15:23:03.000Z","dependencies_parsed_at":"2024-01-02T21:53:25.098Z","dependency_job_id":"e789d870-cd2c-4fb5-a7d7-ee979e5ec8c4","html_url":"https://github.com/machine-learning-apps/gke-kubeconfig","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machine-learning-apps%2Fgke-kubeconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machine-learning-apps%2Fgke-kubeconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machine-learning-apps%2Fgke-kubeconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machine-learning-apps%2Fgke-kubeconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machine-learning-apps","download_url":"https://codeload.github.com/machine-learning-apps/gke-kubeconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246720427,"owners_count":20822899,"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-08-01T07:01:23.228Z","updated_at":"2025-04-01T22:30:40.064Z","avatar_url":"https://github.com/machine-learning-apps.png","language":"Shell","funding_links":[],"categories":["Community Resources"],"sub_categories":["Deployment"],"readme":"![Actions Status](https://github.com/machine-learning-apps/gke-kubeconfig/workflows/Build/badge.svg)\n\n## This Action retrieves a [kubeconfig file](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) from [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engine/)\n\n### This action saves the kubeconfig file into the following directory:\n\n`$GITHUB_WORKSPACE/.kube/config`\n\n- Inside a Docker container running in Actions, $GITHUB_WORKSPACE is mounted such that this directory always equals `/github/workspace`. **Therefore, the kubeconfig file in a subsequent action running in a Docker container can be found at `/github/workspace/.kube/config`**\n\n- Note that outside a Docker container $GITHUB_WORKSPACE is not `/github/workspace` (you must reference the environment variable to see the directory). \n\nThe purpose of this action is to retrieve a kubeconfig file so that other actions can use `kubectl` to interact with your GKE cluster.  An overview of how to retrieve this config file manually are located in [these docs](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl)\n\n\n## Notes on the kubeconfig file:\n\nFrom [this explanation](https://ahmet.im/blog/mastering-kubeconfig/):\n\nIf you’re using `kubectl`, here’s the preference that takes effect while determining which kubeconfig file is used.\n\n1. use `--kubeconfig` flag, if specified\n2. use `KUBECONFIG` environment variable, if specified\n3. use `$HOME/.kube/config file`\n\n\n## Usage\n\n### Example Workflow That Uses This Action\n\nThis action is the third step in the below example: `Submit Argo Deployment`\n\n```yaml\nname: Test GKE kubeconfig\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      # this action will save the kubeconfig file to `/github/workspace/.kube/config`, which is visible to subsequent steps.\n    - name: Get kubeconfig file from GKE\n      uses: machine-learning-apps/gke-kubeconfig@master\n      with:\n        application_credentials: ${{ secrets.APPLICATION_CREDENTIALS }}\n        project_id: ${{ secrets.PROJECT_ID }}\n        location_zone: ${{ secrets.LOCATION_ZONE }}\n        cluster_name: ${{ secrets.CLUSTER_NAME }}\n        \n    - name: Test Kubeconfig File\n      uses: docker://bitnami/kubectl:latest\n      with:\n        args: get namespaces\n      env:\n        # Setting the environment variable KUBECONFIG sets the default config file that kubectl looks for.\n        KUBECONFIG: '/github/workspace/.kube/config'\n```\n\n### Mandatory Arguments\n\n1. `APPLICATION_CREDENTIALS`: base64 encoded GCP application credentials (https://cloud.google.com/sdk/docs/authorizing).  To base64 encode your credentails, you can run this command:\n\n    \u003e cat your-gke-credentials.json | base64\n\n2. `PROJECT_ID`: Name of the GCP Project where the GKE K8s cluster resides.\n3. `LOCATION_ZONE`: The location-zone where your GKE K8s cluster resides, for example, `us-west1-a`\n4. `CLUSTER_NAME`: The name of your GKE K8s cluster.\n\n## Keywords\n MLOps, Machine Learning, Data Science\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachine-learning-apps%2Fgke-kubeconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachine-learning-apps%2Fgke-kubeconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachine-learning-apps%2Fgke-kubeconfig/lists"}