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

how to create a service for every task pod #2654

Closed
shuaiyy opened this issue Jan 17, 2023 · 7 comments
Closed

how to create a service for every task pod #2654

shuaiyy opened this issue Jan 17, 2023 · 7 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@shuaiyy
Copy link

shuaiyy commented Jan 17, 2023

What would you like to be added:

it seems vcjob use pod dns to discover each other, no service.

the task Pod labels don't have a unique label (e.g. task_index or task_pod_name),so i can't create a service manaully with service selector

Why is this needed:

i will create an ingress router for every taskPod for provide http debugging service, so service is need.

@shuaiyy shuaiyy added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 17, 2023
@wangyang0616
Copy link
Member

@shuaiyy sorry to reply you so late.
Volcano's task supports the native semantics of k8s metadata. You can add labels to the template, which will take effect for all pods in the current task.

For example, add mytest: dev labels to a task in the job. The specific yaml file reference is as follows:

apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
  name: priority-high
spec:
  schedulerName: volcano
  minAvailable: 2
  priorityClassName: high-priority
  tasks:
    - replicas: 12
      name: "test"
      template:
        metadata:
          labels:
            mytest: dev
        spec:
          containers:
            - image: alpine
              command: ["/bin/sh", "-c", "sleep 1000"]
              imagePullPolicy: IfNotPresent
              name: running
              resources:
                requests:
                  cpu: "1"
          restartPolicy: OnFailure

@shuaiyy
Copy link
Author

shuaiyy commented Feb 4, 2023

@wangyang0616 thanks for your reply.

My question is not very clear, What I really want is one service for one pod:

Pod                          Service-name
tf-demo-ps-0         tf-demo-ps-0
tf-demo-ps-1          tf-demo-ps-1
tf-demo-worker-0    tf-demo-worker-0
tf-demo-worker-1    tf-demo-worker-1

currently, I can create a service for all pods with a label selector volcano/job-name=tf-demo, volcano/task-role=worker.

But I cannot create a service for a specific task pod, because the pod doesn't have a unique label from other task pods.

I created a releated pr for volcano api in order to set a unique label for every task instance:

add a label key: TaskIndexKey = volcano.sh/task-index #97

@hwdef
Copy link
Member

hwdef commented Feb 8, 2023

This way is not recommended, it's not even k8s best practice.
The number of iptables rules is positively correlated with the number of pods, which can easily cause network performance problems

@shuaiyy
Copy link
Author

shuaiyy commented Feb 8, 2023

@hwdef you’re right and I will not ask volcano-controller to create a service for pod. just add a unique label to pod is enough since service use label selectors to find the target pod.

I can create a service manually and afford a little performance cost when we need service and ingress for a job's pod; It's very useful for ml developers when develop and debug a job on prod env.

@stale
Copy link

stale bot commented May 9, 2023

Hello 👋 Looks like there was no activity on this issue for last 90 days.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity for 60 days, this issue will be closed (we can always reopen an issue if we need!).

@stale stale bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 9, 2023
@zrss
Copy link
Contributor

zrss commented Jul 17, 2023

quite a common case, specially, when it need to login to the specific pod for debug, then we have to create a service that bind to the specific pod of the volcano job.

i suppose the pod of the volcano job should have a unique label too.

@stale
Copy link

stale bot commented Sep 17, 2023

Closing for now as there was no activity for last 60 days after marked as stale, let us know if you need this to be reopened! 🤗

@stale stale bot closed this as completed Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants