All Projects → Azure → k8s-set-context

Azure / k8s-set-context

Licence: MIT license
GitHub Action for setting context and retrieving Kubeconfig before deploying to Kubernetes clusters

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to k8s-set-context

apiclarity
Reconstruct Open API Specifications from real-time workload traffic seamlessly.
Stars: ✭ 290 (+468.63%)
Mutual labels:  k8s
short
URL shortening service. 高性能短链接服务。
Stars: ✭ 14 (-72.55%)
Mutual labels:  k8s
dcos-k8s-rust-skaffold-demo
A demo of pipelining Rust application development to Kubernetes on DC/OS with Skaffold.
Stars: ✭ 40 (-21.57%)
Mutual labels:  k8s
node-healthcheck-operator
K8s Node Health Check Operator
Stars: ✭ 22 (-56.86%)
Mutual labels:  k8s
tailing-sidecar
tailing sidecar - the cluster-level logging agent for Kubernetes
Stars: ✭ 25 (-50.98%)
Mutual labels:  k8s
Book k8sInfra
< 컨테이너 인프라 환경 구축을 위한 쿠버네티스/도커 >
Stars: ✭ 176 (+245.1%)
Mutual labels:  k8s
namespace-provisioner
A Kubernetes operator creating K8s resources by annotating namespaces
Stars: ✭ 52 (+1.96%)
Mutual labels:  k8s
postgres
A PostgreSQL database used by Deis Workflow.
Stars: ✭ 37 (-27.45%)
Mutual labels:  k8s
istio-lab
《Istio 入门与实战》官方配套实验代码库
Stars: ✭ 87 (+70.59%)
Mutual labels:  k8s
k8scc
# K8S Crash Course
Stars: ✭ 16 (-68.63%)
Mutual labels:  k8s
angular-app-kubernetes
Sample Dockerised angular app deployed on Kubernetes on Azure using AKS
Stars: ✭ 42 (-17.65%)
Mutual labels:  k8s
Kubernetes-and-Cloud-Native-Associate-KCNA
Useful notes for the KCNA - Kubernetes and Cloud Native Associate
Stars: ✭ 162 (+217.65%)
Mutual labels:  k8s
k8s note
k8s学习笔记
Stars: ✭ 27 (-47.06%)
Mutual labels:  k8s
kserve
Serverless Inferencing on Kubernetes
Stars: ✭ 1,621 (+3078.43%)
Mutual labels:  k8s
ratel-doc
Kubernetes Dashboard 一键式 Kubernetes多集群资源管理平台 k8s 管理平台
Stars: ✭ 153 (+200%)
Mutual labels:  k8s
falcon-helm
Helm Charts for running CrowdStrike Falcon with Kubernetes
Stars: ✭ 34 (-33.33%)
Mutual labels:  k8s
k8s-graph
Visualize your Kubernetes (k8s) cluster
Stars: ✭ 23 (-54.9%)
Mutual labels:  k8s
netmaker
Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
Stars: ✭ 4,147 (+8031.37%)
Mutual labels:  k8s
gitops-playground
Reproducible infrastructure to showcase GitOps workflows and evaluate different GitOps Operators on Kubernetes
Stars: ✭ 77 (+50.98%)
Mutual labels:  k8s
Anubis
Distributed LMS for automating Computing Science Courses From NYU
Stars: ✭ 184 (+260.78%)
Mutual labels:  k8s

Kubernetes set context

This action can be used to set cluster context before other actions like azure/k8s-deploy and azure/k8s-create-secret. It should also be used before kubectl commands (in script) are run subsequently in the workflow.

It is a requirement to use azure/login in your workflow before using this action when using the service-account or service-principal methods.

There are three approaches for specifying the deployment target:

  • Kubeconfig file provided as input to the action
  • Service account approach where the secret associated with the service account is provided as input to the action
  • Service principal approach (only applicable for arc cluster) where service principal provided with 'creds' is used as input to action

In all these approaches it is recommended to store these contents (kubeconfig file content or secret content) in a secret.

Refer to the action metadata file for details about inputs. Note that different inputs are required for different method and cluster types. Use the below examples as a reference.

Example usage

Kubeconfig approach

- uses: azure/k8s-set-context@v2
  with:
    method: kubeconfig
    kubeconfig: <your kubeconfig>
    context: <context name> # current-context from kubeconfig is used as default

Please note that the input requires the contents of the kubeconfig file, and not its path.

Following are the ways to fetch kubeconfig file onto your local development machine so that the same can be used in the action input shown above.

Azure Kubernetes Service cluster

az aks get-credentials --name
                       --resource-group
                       [--admin]
                       [--file]
                       [--overwrite-existing]
                       [--subscription]

Further details can be found in az aks get-credentials documentation.

Generic Kubernetes cluster

Please refer to documentation on fetching kubeconfig for any generic K8s cluster

Service account approach

- uses: azure/k8s-set-context@v2
  with:
    method: service-account
    k8s-url: <URL of the cluster's API server>
    k8s-secret: <secret associated with the service account>

For fetching Server URL, execute the following command on your shell:

kubectl config view --minify -o 'jsonpath={.clusters[0].cluster.server}'

For fetching Secret object required to connect and authenticate with the cluster, the following sequence of commands need to be run:

kubectl get serviceAccounts <service-account-name> -n <namespace> -o 'jsonpath={.secrets[*].name}'

kubectl get secret <service-account-secret-name> -n <namespace> -o yaml

Service account approach for arc cluster

- uses: azure/k8s-set-context@v2
  with:
    method: service-account
    cluster-type: arc
    cluster-name: <cluster-name>
    resource-group: <resource-group>
    token: "${{ secrets.SA_TOKEN }}"

Service principal approach for arc cluster

- uses: azure/k8s-set-context@v2
  with:
    method: service-principal
    cluster-type: arc
    cluster-name: <cluster-name>
    resource-group: <resource-group>

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].