This commit is contained in:
2026-03-24 18:15:23 +00:00
parent 979943aa4e
commit 2296921364
6 changed files with 81 additions and 5 deletions

2
kaniko/README.md Normal file
View File

@@ -0,0 +1,2 @@
# Kaniko
## Kaniko can be used to automate docker image creation

54
kaniko/kaniko.yaml Normal file
View File

@@ -0,0 +1,54 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kaniko-build-context
namespace: kaniko
data:
Dockerfile: |
FROM nginx:stable
COPY index.html /usr/share/nginx/html/index.html
index.html: |
<html>
<head><title>Kaniko Test</title></head>
<body>
<h1>Hello from Kaniko</h1>
<p>This image was built inside Kubernetes and pushed to Harbor.</p>
</body>
</html>
---
apiVersion: batch/v1
kind: Job
metadata:
name: kaniko-build-to-harbor
namespace: kaniko
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:v1.23.2
args:
- --context=dir:///workspace
- --dockerfile=/workspace/Dockerfile
- --destination=docker-repo.apps.undercloud.dev/library/kaniko-demo:latest
- --cleanup
volumeMounts:
- name: build-context
mountPath: /workspace
- name: docker-config
mountPath: /kaniko/.docker
volumes:
- name: build-context
configMap:
name: kaniko-build-context
- name: docker-config
secret:
secretName: harbor-creds
items:
- key: .dockerconfigjson
path: config.json

4
kaniko/namespace.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kaniko

18
kaniko/secrets.yaml Normal file
View File

@@ -0,0 +1,18 @@
---
apiVersion: v1
kind: Secret
metadata:
name: harbor-creds
namespace: kaniko
type: kubernetes.io/dockerconfigjson
stringData:
.dockerconfigjson: |
{
"auths": {
"docker-repo.apps.undercloud.dev": {
"username": "admin",
"password": "4IsTheMindKiller",
"auth": "YWRtaW46UkVQTEFDRV9NRQ=="
}
}
}