GoogleContainerTools / GoogleContainerTools/skaffold
Skaffold isn't building images in minikubes docker engine when kube-context is set
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
If i've got my kubectl context set to my EKS, but have my skaffold.yaml file containing
```
deploy:
kubeContext: minikube
```
or use the cli override
```
skaffold dev --kube-context minikube
```
The build proceeds but fails to attach to the deployed pods.
### Expected behavior
skaffold uses the minikube context and proceeds normally
### Actual behavior
It fails to finish starting up. K8's saying it can't find the images built.
```
Waiting for deployments to stabilize...
- ignite:deployment/ignite-job-execution-api: waiting for init container init-wait-for-db to complete
- ignite:pod/ignite-job-execution-api-7547c5bf75-kfngj: waiting for init container init-wait-for-db to complete
> Error retrieving logs for pod ignite-job-execution-api-7547c5bf75-kfngj: exit status 1.
Try `kubectl logs ignite-job-execution-api-7547c5bf75-kfngj -n ignite -c init-wait-for-db`
- ignite:statefulset/ignite-job-execution-api-postgresql: Waiting for 1 pods to be ready...
- ignite:statefulset/ignite-job-execution-api-postgresql is ready. [1/2 deployment(s) still pending]
```
```
Container image "ignite-job-execution-api:04360cf25ac6db9339ddf82583f8f3bb890483046e33aa52f34d55993491b399" is not present with pull policy of Never
```
I think it's building the images in the wrong docker context.
### Information
- Skaffold version: v2.3.1
- Operating system: MacOS 13.3.1 (22E261)
- Installed via: Homebrew
- Contents of skaffold.yaml:
only other thing I think is worth mentioning is that I installed kubectl directly and am not using minikube's version of kubectl. When I was using minikubes kubectl it kept trying to connect to minikube even though we had context setup to talk to EKS.
```yaml
apiVersion: skaffold/v4beta2
kind: Config
metadata:
name: ignite-job-execution-api
build:
artifacts:
- image: ignite-job-execution-api-spark
context: .
docker:
dockerfile: SparkJava17.Dockerfile
- image: ignite-job-execution-api
docker:
dockerfile: Dockerfile
sync:
infer:
- 'src/**'
context: .
deploy:
kubeContext: minikube
helm:
releases:
- name: ignite-job-execution-api
createNamespace: true
namespace: ignite
chartPath: chart/ignite-job-execution-api
valuesFiles:
- chart/ignite-job-execution-api/values.yaml
setValueTemplates:
aws.endpoint: "http://localstack.localstack:4566"
local: true
image.ecr.enabled: false
app.spark.image: "{{.IMAGE_NAME_ignite_job_execution_api_spark}}"
app.spark.image_version: "{{.IMAGE_TAG_ignite_job_execution_api_spark}}"
version: 0.0.0
profiles:
- name: dev
activation:
- command: dev
patches:
- op: replace
path: /build/artifacts/1/docker/dockerfile
value: dev.Dockerfile
```
### Steps to reproduce the behavior
1. Set kubectl current context to something other than minikube `kubectl config use-context XXX.us-east-1.eksctl.io`
2. `skaffold dev --kube-context minikube`
3. build fails to use minikubes docker engine, so image builds aren't reachable
4. switch current context over to minikube `kubectl config use-context minikube`
5. build works fine
Contributor guide
Assessment
This issue has not been assessed yet.