我在Windows的docker上使用kubernetes。
而且我想使用Kaniko,但无法在本地kubernetes上构建映像。
Dockerfile
FROM ubuntu:18.04
RUN apt update
RUN apt install -y ssh
kanikopod.yaml
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- image: gcr.io/kaniko-project/executor:latest
args:
- --dockerfile=/mnt/Dockerfile
- --context= /mnt
- --no-push
name: kaniko
command:
- sleep
- infinity
volumeMounts:
- mountPath: /mnt
name: mount-volume
restartPolicy: Never
volumes:
- name: mount-volume
persistentVolumeClaim:
claimName: kaniko-workspace
但是发生ContainerCannotRun错误。
kubectl描述豆荚加尼子
结果是
Name: kaniko
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: docker-desktop/192.168.65.3
Start Time: Mon, 06 May 2019 18:13:47 +0900
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"kaniko","namespace":"default"},"spec":{"containers":[{"args":["--dock...
Status: Pending
IP:
Containers:
kaniko:
Container ID:
Image: gcr.io/kaniko-project/executor:latest
Image ID:
Port: <none>
Host Port: <none>
Command:
sleep
infinity
Args:
--dockerfile=/mnt/Dockerfile
--context= /mnt
--no-push
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/mnt from mount-volume (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-spjnr (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
mount-volume:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: kaniko-workspace
ReadOnly: false
default-token-spjnr:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-spjnr
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 4s default-scheduler Successfully assigned default/kaniko to docker-desktop
kubectl日志kaniko
但是没有输出。
我认为kaniko需要使用“ --destination =”选项,但我找不到该信息。
我该怎么办?
答案 0 :(得分:1)
尝试删除此行:
command:
- sleep
- infinity