Skip to content

Instantly share code, notes, and snippets.

@alo9507
Created April 30, 2021 16:57
Show Gist options
  • Save alo9507/1d1538d3767d856162209cbca25a81a4 to your computer and use it in GitHub Desktop.
Save alo9507/1d1538d3767d856162209cbca25a81a4 to your computer and use it in GitHub Desktop.
Use GitHub Actions and Kubeconfig to deploy to Kubernetes
name: Deploy to Kubernetes
on:
push:
branches: [ development ]
pull_request:
branches: [ development ]
jobs:
deploy:
name: Deploy to Kubernetes
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create kubeconfig
run: |
mkdir ${HOME}/.kube
echo ${{ secrets.KUBE_CONFIG }} | base64 --decode > ${HOME}/.kube/config
cat ${HOME}/.kube/config
- name: Use context
run: kubectl config use-context octobay-api
- name: Deploy to K8s
run: kubectl apply -f k8s/
@akotek
Copy link

akotek commented Jun 1, 2022

nice! curious how come kubectl is installed on the machine?

@agonzalezo
Copy link

nice! curious how come kubectl is installed on the machine?

ubuntu-latest is a custom docker image provided by github with a lot of tools to build apps like docker cli, kubectl, gcc , etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment