Kubernetes - Deploying older version of app in new API I'm working with yaml files built for an older version of the API

apiVersion: extensions/v1beta1


I tried changing to 

apiVersion: apps/v1 


But 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- 
unreachable


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? 
1. Change the fw rule to ACCEPT
2. make the correct changes to yaml file (need help with that)
&emsp;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: null
  labels:
    io.kompose.service: web
  name: web
spec:
  type: NodePort
  ports:
  - name: "8080"
    port: 8080
    targetPort: 8080
    nodePort: 30080
  selector:
    io.kompose.service: web
status:
  loadBalancer: {}
Prior to apps/v1 the selector field was implicitly picked up from the pod template's labels. So in your case it would be:

spec:
  selector:
    matchLabels:
      io.kompose.service: web


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.