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

Port forwarding not working when official image is referenced #2066

Closed
demisx opened this issue May 3, 2019 · 5 comments
Closed

Port forwarding not working when official image is referenced #2066

demisx opened this issue May 3, 2019 · 5 comments

Comments

@demisx
Copy link
Contributor

demisx commented May 3, 2019

Expected behavior

Port forwarding should work no matter if the image is pulled directly from Docker hub or built locally

Actual behavior

Port forwarding works only if image is build locally.

Information

  • Skaffold version: version: v0.28.0
  • Operating system: MacOS 10.14.4
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta9
kind: Config
profiles:
  - name: dev
    activation:
      - command: dev
    deploy:
      kubectl:
        manifests:
          - app/k8s/dev/k8s-elastic-search.yaml
    build:
      artifacts:
        - image: dl-org-elasticsearch
          docker:
            dockerfile: app/elastic-search/Dockerfile

Steps to reproduce the behavior

# Dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.1
# Port forwarding works here
apiVersion: v1
kind: Service
metadata:
  name: elasticsearch
  labels:
    component: elasticsearch
    tier: backend
spec:
  # type: LoadBalancer
  ports:
    - port: 9200
      targetPort: 9200
  selector:
    component: elasticsearch
    tier: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
  labels:
    component: elasticsearch
    tier: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      component: elasticsearch
      tier: backend
  template:
    metadata:
      labels:
        component: elasticsearch
        tier: backend
    spec:
      containers:
        - name: elasticsearch
          image: dl-org-elasticsearch # <-- locally built image
          env:
            - name: discovery.type
              value: single-node
          ports:
            - containerPort: 9200
# Port forwarding DOES NOT WORK
apiVersion: v1
kind: Service
metadata:
  name: elasticsearch
  labels:
    component: elasticsearch
    tier: backend
spec:
  # type: LoadBalancer
  ports:
    - port: 9200
      targetPort: 9200
  selector:
    component: elasticsearch
    tier: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
  labels:
    component: elasticsearch
    tier: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      component: elasticsearch
      tier: backend
  template:
    metadata:
      labels:
        component: elasticsearch
        tier: backend
    spec:
      containers:
        - name: elasticsearch
          image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.1 # <-- official image
          env:
            - name: discovery.type
              value: single-node
          ports:
            - containerPort: 9200
@priyawadhwa
Copy link
Contributor

Hey @demisx this behavior is currently expected -- only containers that contain images specified as skaffold artifacts will be port forwarded.

We're working on adding user defined port-forwarding, which would allow you to specify additional containers to port-forward. Until that feature is fleshed out and merged, unfortunately this will continue to work as you've experienced.

@demisx
Copy link
Contributor Author

demisx commented May 6, 2019

Got it. Thank you very much for your explanation. Would be really helpful if documentation page https://skaffold.dev/docs/how-tos/portforward/ mentioned this too. 👍 Shall I close this issue then?

@priyawadhwa
Copy link
Contributor

Agree that documentation would be helpful, would you be interested in submitting a PR?

Feel free to close the issue as well, as it's effectively a dupe of #1311

@demisx
Copy link
Contributor Author

demisx commented May 6, 2019

Sure. I'll take a stab. I've created #2078 this PR with clarification added. Let me now if I need to add anything else.

@demisx
Copy link
Contributor Author

demisx commented May 6, 2019

I can definitely take a stab at the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants