Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Is there any variable which is available in helm to get the current replica cycle value?

Is there any variable which is available in helm to get the current replica cycle value? I would like to increase the replicacount of deployment by exposing replicacount value in values.yaml of helm with this we need to update one parameter for each replicas.

there is one param in our yaml "serverName", we need to change it's values for each replica, like serverName: "server" then we need to pass values like "server-0", "server-1", "server-2" to each replica (0, 1, 2).

Is there any way?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

No, you cannot pass a different values for every replica.

Why? Because it's in the definition of the word "replica":

replica: an exact copy of an object

Replica is an exact copy, thus you cannot make it different in any way. And kubernetes is not going to help you with it.

Answering to your other question:

How to get the current replica count? I would like to increase the replicacount of deployment by exposing replicacount value

Kubernetes applies declarative model. You declare how many replicas you want and it will do it's best to match it. You don't need to know your current count to scale it up or down (at least that's what I understand you are trying to do based on your question).

Just put the replicacount variable in the values.yaml file and reference it in helm chart. It's that easy.

over 4 years ago · Santiago Trujillo Relatório

0

If your application code looks at its own hostname (as in the shell hostname command or the C gethostname function), it will be the name of the current pod. This will be unique across every replica.

If checking the hostname is inconvenient for your code, you can also use the downward API to inject the pod name as an environment variable (example copied directly from the linked Kubernetes documentation):

env:
  - name: MY_POD_NAME
    valueFrom:
      fieldRef:
        fieldPath: metadata.name

There's no way to inject this data into a file without using something like an init container or an entrypoint script. The mechanisms Kubernetes has to inject files (for example, mounting a ConfigMap in a container) only inject fixed file content, and it will always be identical across all replicas.

If you specifically need the names to be in the sequential order you propose, or you need a name to be reused to recover storage, a StatefulSet will generate the pod names exactly like that (it also can automatically allocate storage, and starts the pods in a specific order).

There's nothing in Helm that would let you have a different configuration per replica. Its templating will help you construct the names and contents of the StatefulSet/Service/ConfigMap/... objects, but once you've created those, the Kubernetes controllers that create the individual Pods still work the same way, and still create some number of mostly-identical Pods with the same behavior.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda