I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …
:date_long | 1 min Read
Kaniko
Kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster.
kaniko doesn’t depend on a Docker daemon and executes each command within a Dockerfile completely in userspace. This enables building container imagesin environments that can’t easily or securely run a Docker daemon, such as a standard Kubernetes cluster.
root@scw-k8s-cmdx:~# cat kaniko-pod.yaml
---
apiVersion: v1
data:
REGISTRY_IP: 51.15.247.30
kind: ConfigMap
metadata:
creationTimestamp: null
name: registry-cm
---
apiVersion: v1
data:
Dockerfile: |-
FROM nginx:alpine
RUN echo "Kaniko dude!" > /usr/share/nginx/html/index.html
kind: ConfigMap
metadata:
name: dockerfile
namespace: default
---
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args: [ "--verbosity=debug",
"--insecure",
"--dockerfile=/workspace/Dockerfile",
"--context=dir://workspace",
"--destination=$(REGISTRY_IP):5000/supercool:1.0"]
env:
- name: REGISTRY_IP
valueFrom:
configMapKeyRef:
name: registry-cm
key: REGISTRY_IP
volumeMounts:
- name: dockerfile-cm
mountPath: /workspace
restartPolicy: Never
volumes:
- name: dockerfile-cm
configMap:
name: dockerfile
items:
- key: "Dockerfile"
path: "Dockerfile"
See whether a container was pushed
root@scw-k8s-cmdx:~# curl -X GET http://$(curl ifconfig.me):5000/v2/_catalog