--- 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: |
This image was built inside Kubernetes and pushed to Harbor.
--- 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