I have created a small cluster and followed this and it throws me some error mentioned in this issue.
That problem aside i have copied my local lxc image from container. I have pushed that to my vm where the pod will be scheduled. The lxc image list
verify that the image is there but still when it tried to deploy my pod i get these errors.
2m15s Normal Scheduled Pod/lxc-deployment-54c4fc4d68-c52zh Successfully assigned default/lxc-deployment-54c4fc4d68-c52zh to nodek2
113s (x11 over 51m) Warning InvalidDiskCapacity Node/nodek2 invalid capacity 0 on image filesystem
113s (x10 over 46m) Warning ImageGCFailed Node/nodek2 invalid capacity 0 on image filesystem
108s (x4 over 2m15s) Warning ErrImageNeverPull Pod/lxc-deployment-54c4fc4d68-c52zh Container image "nginx-image" is not present with pull policy of Never
108s (x4 over 2m15s) Warning Failed Pod/lxc-deployment-54c4fc4d68-c52zh Error: ErrImageNeverPull
My deployment is pretty straight forward.
metadata:
name: lxc-deployment
spec:
replicas: 1
selector:
matchLabels:
app: lxc-container
template:
metadata:
labels:
app: lxc-container
spec:
containers:
- name: lxc-container
image: nginx-image
imagePullPolicy: Never
ports:
- containerPort: 80
command: ["/bin/sh"]
args: ["-c", "echo 'Hello from Container $HOSTNAME'"]
nodeSelector:
containerruntime: lxd
tolerations:
- key: containerruntime
operator: Exists
Issues solved. The kubernetes can not read the lxc images directly via docker or containerd, you have to convert it to docker or you have to use lxe container runtime to use lxc images with k8s.