Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kvaps/kubectl-build
Build dockerfiles directly in your Kubernetes cluster.
https://github.com/kvaps/kubectl-build
docker kaniko kubectl kubectl-plugin kubectl-plugins kubernetes
Last synced: 6 days ago
JSON representation
Build dockerfiles directly in your Kubernetes cluster.
- Host: GitHub
- URL: https://github.com/kvaps/kubectl-build
- Owner: kvaps
- License: apache-2.0
- Created: 2020-08-28T16:26:58.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T23:01:51.000Z (almost 3 years ago)
- Last Synced: 2024-08-07T06:06:02.463Z (3 months ago)
- Topics: docker, kaniko, kubectl, kubectl-plugin, kubectl-plugins, kubernetes
- Language: Shell
- Homepage:
- Size: 56.6 KB
- Stars: 146
- Watchers: 8
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kubectl build
Kubectl build mimics the kaniko executor, but performs building on your Kubernetes cluster side.
This allows you to simply build your local dockerfiles remotely without leaving your cozy environment.![demo](https://gist.githubusercontent.com/kvaps/7d823b727a87d244d1f25deb5ff592da/raw/13062e62deb269f9385bc1c995382a589c34f04b/kubectl-build.gif)
## Installation
using [krew](https://krew.sigs.k8s.io/):
kubectl krew index add kvaps https://github.com/kvaps/krew-index
kubectl krew install kvaps/buildor using curl:
```bash
curl -LO https://github.com/kvaps/kubectl-build/raw/master/kubectl-build
chmod +x ./kubectl-build
sudo mv ./kubectl-build /usr/local/bin/kubectl-build
```## Usage
```bash
kubectl build [args]
```## Examples
```bash
# Show all kaniko commands
kubectl build --help# Build from current directory
kubectl build --context . --no-push# Specify namespace and kubeconfig
kubectl build --context . --no-push --namespace default --kubeconfig ~/.kube/someconfig# Login to remote registry
docker login docker.io# Short form
kubectl build -c . -d docker.io/some/image:latest# Run debug shell
kubectl build -c . --no-push --debug# Use cache building
kubectl build --context . --destination docker.io/some/image:latest --cache --cache-repo docker.io/some/cache# Save image name and digest to file
kubectl build --context . --destination docker.io/some/image:latest --digest-file /tmp/digest --image-name-with-digest-file /tmp/image# Build from stdin
tar -cvf- . | kubectl build --destination docker.io/some/image:latest --context tar://stdin
```## Extra configuration
While standard behavior of kubectl-build plugin intend to repeat kaniko executor options. The additional configuration can be specified by setting environment variables.
This may be useful for both having permanent configuration and setting CI-systems.
| Enivroment Variable | Description | Default value |
|------------------------------------|--------------------------------------------------------------------------------|----------------------------------|
| `KUBECTL_BUILD_CONTEXT` | Kubernetes context for creating pod (may be overriden by `--kubecontext`) | current context |
| `KUBECTL_BUILD_DOCKER_CONFIG` | Path to dockerconfig file to forward | `~/.docker/config.json` |
| `KUBECTL_BUILD_IMAGE` | Kaniko-executor image | `gcr.io/kaniko-project/executor` |
| `KUBECTL_BUILD_KEEP_POD` | If set to `true` do not delete pod after finising process | `false` |
| `KUBECTL_BUILD_KUBECONFIG` | Path to kubeconfig file for creating pods (may be overriden by `--kubeconfig`) | kubectl defaults |
| `KUBECTL_BUILD_METADATA_OVERRIDES` | Json patch to override metadata for creating pods | `{}` |
| `KUBECTL_BUILD_NAME_OVERRIDE` | Name for creating pod | `kaniko-rand6n` |
| `KUBECTL_BUILD_NAMESPACE` | Kubernetes namespace for creating pod (may be overriden by `--namespace`) | current namespace |