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

271
Visualizações
Kubernetes equivalent of 'docker run -it'

I have one docker image and I am using following command to run it.

docker run -it -p 1976:1976 --name demo demo.docker.cloud.com/demo/runtime:latest

I want to run the same in Kubernetes. This is my current yaml file.

apiVersion: v1
kind: Deployment
metadata:
  name: demo-deployment
  labels:
    app: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo
  template:
    metadata:
      labels:
        app: demo
    spec:
      containers:
      - name: demo
        image: demo.docker.cloud.com/demo/runtime:latest
        ports:
        - containerPort: 1976
        imagePullPolicy: Never

This yaml file covers everything except flag "-it". I am not able to find its Kubernetes equivalent. Please help me out with this. Thanks

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

0

I assume you are trying to connect a shell to your running container. Following the guide at https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/ - You would need the following commands. To apply your above configuration:

Create the pod: kubectl apply -f ./demo-deployment.yaml

Verify the Container is running: kubectl get pod demo-deployment

Get a shell to the running Container: kubectl exec -it demo-deployment -- /bin/bash

over 4 years ago · Santiago Trujillo Relatório

0

Looking at the Container definition in the API reference, the equivalent options are stdin: true and tty: true.

(None of the applications I work on have ever needed this; the documentation for stdin: talks about "reads from stdin in the container" and the typical sort of server-type processes you'd run in a Deployment don't read from stdin at all.)

over 4 years ago · Santiago Trujillo Relatório

0

kubectl run is the close match to docker run based on the requested scenario.

Some examples from Kubernetes documentation and it's purpose :

kubectl run -i --tty busybox --image=busybox -- sh  # Run pod as interactive shell
kubectl run nginx --image=nginx -n 
mynamespace                                         # Run pod nginx in a specific namespace
kubectl run nginx --image=nginx                     # Run pod nginx and write its spec into a file called pod.yaml
--dry-run=client -o yaml > pod.yaml

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