Skip to content

Commit 8071a8a

Browse files
committed
first commit
0 parents  commit 8071a8a

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# eks version
2+
FROM alpine/k8s:1.16.8
3+
4+
LABEL maintainer="Rokhun Jung <j.rokhun@gmail.com>"
5+
6+
COPY entrypoint.sh /entrypoint.sh
7+
ENTRYPOINT ["/entrypoint.sh"]

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Github Action for Kubernetes CLI
2+
3+
- image based on Alpine/k8s.
4+
5+
## Usage
6+
7+
`.github/workflows/eks.yml`
8+
9+
```hcl
10+
on: push
11+
name: deploy
12+
jobs:
13+
deploy:
14+
name: Deploy to cluster
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@master
18+
- name: deploy to cluster
19+
uses: qazz92/kubectl@1.0.0
20+
env:
21+
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
22+
with:
23+
args: set image --record deployment/my-app container=${{ github.repository
24+
}}:${{ github.sha }}
25+
- name: verify deployment
26+
uses: qazz92/kubectl@1.0.0
27+
env:
28+
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
29+
with:
30+
args: '"rollout status deployment/my-app"'
31+
```
32+
33+
## Secrets
34+
35+
`KUBE_CONFIG_DATA`**required**: A base64-encoded kubeconfig file with credentials for Kubernetes to access the cluster. You can get it by running the following command:
36+
37+
```bash
38+
cat $HOME/.kube/config | base64
39+
```
40+
41+
**Note**: Do not use kubectl config view as this will hide the certificate-authority-data.

action.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: kubectl-eks
2+
description: "'kubectl' for eks"
3+
author: 'Rokhun Jung'
4+
branding:
5+
icon: 'box'
6+
color: 'gray-dark'
7+
runs:
8+
using: 'docker'
9+
image: 'Dockerfile'

entrypoint.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Extract the base64 encoded config data and write this to the KUBECONFIG
6+
echo "$KUBE_CONFIG_DATA" | base64 --decode > /tmp/config
7+
export KUBECONFIG=/tmp/config
8+
9+
sh -c "kubectl $*"

0 commit comments

Comments
 (0)