How toctoc/kubernetes-action works
Project type and purpose
• This is an open-source GitHub Action (“kubernetes-action”) that wraps kubectl (and optionally AWS EKS credentials) in a Docker container.
• Its purpose is to let users run arbitrary kubectl commands against a Kubernetes cluster (including EKS) as a step in a GitHub workflow.
File structure
• Top-level files:
• Dockerfile – builds the container image with kubectl (and AWS CLI) installed
• entrypoint.sh – the shell script that decodes secrets, invokes kubectl, and returns output
• action.yml – metadata for the GitHub Action (inputs, outputs, runs-on specification)
• README.md – documentation
• No frontend/backend split; this is a single containerized CLI tool.
• No microservices or multiple modules. The container is the sole deployment unit.
Extract architectural insights from the README
• Inputs: KUBE_CONFIG_DATA (base64 kubeconfig), plus optional AWS creds for EKS
• Workflow integration: users include this action in a job step after checkout (and optional AWS credentials action)
• Outputs: the action captures stdout from kubectl and returns it as the result output variable
a. Main Components
1. GitHub Actions Runner – the VM/container that hosts the workflow steps
2. Jberlinsky/kubernetes-action Container – built from Dockerfile, includes kubectl & entrypoint.sh
3. Kubernetes Cluster (generic) or AWS EKS Control Plane – the target API server
4. (Optional) AWS IAM / AWS STS – for EKS authentication when AWS creds are provided
5. GitHub Secrets Store – holds KUBE_CONFIG_DATA, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
b. Relationships & Interactions
• Developer pushes code → GitHub Events → GitHub Actions Runner spins up
• Runner retrieves secrets from GitHub Secrets and injects them as environment variables into the container
• Runner invokes the Action container, running entrypoint.sh with the user-supplied args
• entrypoint.sh decodes KUBE_CONFIG_DATA to $HOME/.kube/config, invokes AWS CLI (if EKS), then calls kubectl
• kubectl sends HTTPS requests to the Kubernetes API server (generic or EKS control plane)
• Runner captures stdout/stderr of kubectl, maps it to the action’s result output
• Downstream steps in the workflow can reference ${{ steps.<id>.outputs.result }}
c. Architectural patterns & principles
• Containerized CLI as a reusable GitHub Action
• Single responsibility: one action focuses solely on running kubectl commands
• Declarative interface via action.yml inputs/outputs
• Secure secret management via GitHub’s secrets injection
d. Key technologies/frameworks
• Docker
• GitHub Actions toolkit (action.yml, metadata syntax)
• bash shell scripting (entrypoint.sh)
• kubectl
• AWS CLI (for EKS integration)