Files
k8s-apps/kaniko/build-kaniko-test.yaml
2026-03-27 21:18:05 +00:00

54 lines
1.3 KiB
YAML

---
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