Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "Port forward",but "invalid container port" #1344

Closed
xianzheTM opened this issue Nov 29, 2021 · 4 comments
Closed

Use "Port forward",but "invalid container port" #1344

xianzheTM opened this issue Nov 29, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@xianzheTM
Copy link

xianzheTM commented Nov 29, 2021

I have see #1326 .

k9s version: 0.25.7
k8s version: 1.19.9
OS:win11

This is my deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "53"
    meta.helm.sh/release-name: dc
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2021-11-24T11:25:28Z"
  generation: 55
  labels:
    app.kubernetes.io/instance: dc
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: device-center
    app.kubernetes.io/version: 1.16.0
    component: service
    helm.sh/chart: device-center-0.1.5
  name: dc-device-center-service
  namespace: default
  resourceVersion: "46964292"
  selfLink: /apis/apps/v1/namespaces/default/deployments/dc-device-center-service
  uid: c5d87ada-11df-4847-935a-b1a8ad1d6b6f
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: dc
      app.kubernetes.io/name: device-center
      component: service
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: dc
        app.kubernetes.io/name: device-center
        component: service
    spec:
      containers:
      - args:
        - --spring.profiles.active=configmap
        env:
        - name: JAVA_OPTS
          value: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
        - name: SPRING_DATASOURCE_PASSWORD
          valueFrom:
            secretKeyRef:
              key: dc-postgresql-password
              name: app-secrets
        - name: REDIS_SINGLE_PASSWORD
          valueFrom:
            secretKeyRef:
              key: redis-password
              name: app-secrets
              optional: true
        image: xxx
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /actuator/health/liveness
            port: http
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: device-service
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /actuator/health/readiness
            port: http
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
        securityContext: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /app/config
          name: profile-yaml
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: dc-device-center
      serviceAccountName: dc-device-center
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          items:
          - key: service-profile-yaml
            path: application-configmap.yaml
          name: dc-device-center
        name: profile-yaml
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2021-11-26T09:19:36Z"
    lastUpdateTime: "2021-11-26T09:19:36Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2021-11-26T05:59:26Z"
    lastUpdateTime: "2021-11-26T11:53:13Z"
    message: ReplicaSet "dc-device-center-service-75fb549884" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 55
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

In env , i add "Remote JVM debug port".I used kubectl port-forward ...,it's ok!.
But in k9s:
image
And annother port 8080,everything is normal.

@matthiasdg
Copy link

Noticed similar behavior; you can port forward exposed ports (8080 in your case), or random ports if there aren't any exposed ports in your Kubernetes deployments.
However, if there are exposed ports defined in your Kubernetes deployments, you can currently only port forward those ports, and no others. I'm also troubled by this (it used to work before version 0.25, IIRC)

@derailed derailed added the bug Something isn't working label Nov 30, 2021
@derailed
Copy link
Owner

@xianzheTM @matthiasdg Sorry guys! Overshot this deal. I see the issue here with non exposed port. Will fix in the next drop...

@derailed
Copy link
Owner

derailed commented Dec 3, 2021

@xianzheTM @matthiasdg Let see if we're once again happy as hippos on v0.25.8. If not please advise Tx!!

@derailed derailed closed this as completed Dec 3, 2021
@matthiasdg
Copy link

Works now, thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants