Expected behavior
Stated warning should NOT be displayed.
Actual behavior
Every time I make a change and trigger a re-deployment, I get an error like:
WARN[0064] image [gcr.io/wired-benefit-XXXXX/demoapp] is not used by the deployment
Yet the image is modified with the updated change, so I'm not sure what the error is indicating,
Information
- Skaffold version: version... v1.15.0
- Operating system: ... MacOS Catilina 10.15.16
- Contents of skaffold.yaml:
apiVersion: skaffold/v2beta8
kind: Config
metadata:
name: demoapp
build:
artifacts:
- image: gcr.io/wired-benefit-293406/demoapp
deploy:
kubectl:
manifests:
- k8*.yml
Content of K8s manifests :
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demoapp
name: demoapp
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: demoapp
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: demoapp
spec:
containers:
- image: gcr.io/wired-benefit-293406/demoapp
imagePullPolicy: IfNotPresent
name: demoapp
restartPolicy: Always
apiVersion: v1
kind: Service
metadata:
labels:
app: demoapp
name: demoapp-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 3000
selector:
app: demoapp
type: LoadBalancer
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: demoapp
spec:
maxReplicas: 5
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: demoapp
targetCPUUtilizationPercentage: 80
Steps to reproduce the behavior
- a very basic starter demo app
skaffold dev- Any change ... docker build is successful by skaffold and even pushing to registry
But, changes are not being reflected. Could be tag related problem. When I manually set the image name to latest for the deployment, then app change works.
As I said in the comment:
Talking specifically about the content included in
Content of K8s manifests, this file is missing three dashes(---)between the resources.It could be fixed either by:
skaffold.yamland it's templatek8*.yml):k8s-deployment.yamlk8s-service.yamlk8s-hpa.yaml---between each of the resource inContent of K8s manifests(example):You can read more about
---in YAML files by following this StackOverflow answer:As for the reproduction. I used the the official getting started guide:
I copied the
Content of K8s manifestsinto thek8s-pod.yamland changed the line (this file does not have---between the resources):Running below command with:
$ skaffold devFocusing on:
As you can see only the
HPAobject was created.DeploymentandServicewas not created. It's also showing the same warning as yours.Editing the
k8s-pod.yamlfile to include---and running$ skaffold devonce again should produce output similar to the one below:As you can see above all of the resources were created, there was no warning about the deployment not using an image and also the app responded.
Additional resources: