patternkubernetesMinor
Kubernetes - Deploying older version of app in new API
Viewed 0 times
newdeployingappversionkubernetesapiolder
Problem
I'm working with yaml files built for an older version of the API
I tried changing to
But couldn't figure out the correct "selector" formatting. So I changed back to v1beta1
Then I ran across this command:
All seemed to deploy correctly. But now when I try to reach my app, I get connection refused. After some investigation, I took a look at iptables and see this:
After some more research, this seems to have something to do with kube-proxy and "selector".
Question is, what's the right course of action?
a. If so, do I delete the deployment and then make correct changes, then redeploy?
Here's my deployment yaml file:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose -f ../docker-compose.yaml convert
kompose.version: 1.10.0 (8bb0907)
creationTimestamp: null
labels:
io.kompose.service: web
name: web
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: web
spec:
containers:
- image: linuxacademycontent/rs-web:latest
name: web
ports:
- containerPort: 8080
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
restartPolicy: Always
status: {}
And my service yaml file:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose -f ../docker-compose.yaml convert
kompose.version: 1.10.0 (8bb0907)
creationTimestamp:
apiVersion: extensions/v1beta1I tried changing to
apiVersion: apps/v1But couldn't figure out the correct "selector" formatting. So I changed back to v1beta1
Then I ran across this command:
kubectl convert -f . | kubectl -n robot-shop create -f -All seemed to deploy correctly. But now when I try to reach my app, I get connection refused. After some investigation, I took a look at iptables and see this:
iptables -L | grep 30080
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0
/* robot-shop/web:8080 has no endpoints */ ADDRTYPE match
dst-type LOCAL tcp dpt:30080 reject-with icmp-port-
unreachableAfter some more research, this seems to have something to do with kube-proxy and "selector".
Question is, what's the right course of action?
- Change the fw rule to ACCEPT
- make the correct changes to yaml file (need help with that)
a. If so, do I delete the deployment and then make correct changes, then redeploy?
Here's my deployment yaml file:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose -f ../docker-compose.yaml convert
kompose.version: 1.10.0 (8bb0907)
creationTimestamp: null
labels:
io.kompose.service: web
name: web
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: web
spec:
containers:
- image: linuxacademycontent/rs-web:latest
name: web
ports:
- containerPort: 8080
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
restartPolicy: Always
status: {}
And my service yaml file:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose -f ../docker-compose.yaml convert
kompose.version: 1.10.0 (8bb0907)
creationTimestamp:
Solution
Prior to apps/v1 the selector field was implicitly picked up from the pod template's labels. So in your case it would be:
Starting with apps/v1 an explicit selector field is required by the Kubernetes API.
I would suggest not to change the iptables on your own as it it the responsibility of your Kubernetes network plugin and is most likely done well.
As far as I am concerned you may simple update the Deployment manifest and no uninstall is required.
spec:
selector:
matchLabels:
io.kompose.service: webStarting with apps/v1 an explicit selector field is required by the Kubernetes API.
I would suggest not to change the iptables on your own as it it the responsibility of your Kubernetes network plugin and is most likely done well.
As far as I am concerned you may simple update the Deployment manifest and no uninstall is required.
Code Snippets
spec:
selector:
matchLabels:
io.kompose.service: webContext
StackExchange DevOps Q#9846, answer score: 1
Revisions (0)
No revisions yet.