Questions tagged [kubernetes-container]
33 questions
                    
                    28
                    
            votes
                
                3 answers
            
        Why do we need a port/containerPort in a Kuberntes deployment/container definition?
When I define e.g. a deployment in Kubernetes there is a section with a list of containers and each of them contains an array of ports, e.g.:
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
      - name: my-nginx
 …
         
    
    
        Ilya Chernomordik
        
- 27,817
- 27
- 121
- 207
                    6
                    
            votes
                
                3 answers
            
        Can we have same kind of multiple containers in a Pod in Kubernetes?
For instance can I have following yaml to produce a pod with multiple containers:
apiVersion: v1
kind: Pod
metadata:
name: lampapp
labels:
    app: app
spec:
  containers:
  - name: lampdb
    image: mysql_test
  - name: app
    image:…
         
    
    
        Madhurima Mishra
        
- 1,063
- 3
- 14
- 27
                    4
                    
            votes
                
                2 answers
            
        Kubernetes command and args in YAML file
What is the difference between the below three declarations in a Pod YAML file:
containers:
name: busybox
image: busybox
args:
-sleep
-"1000"
containers:
name: busybox
image: busybox
command: ["/bin/sh", "-c", "sleep…
         
    
    
        PS-Atl
        
- 51
- 1
- 3
                    3
                    
            votes
                
                3 answers
            
        Increase startup threshold for k8s container in v1.12
Following the documentation here, I could set the threshold for container startup like so:
startupProbe:
  httpGet:
    path: /healthz
    port: liveness-port
  failureThreshold: 30
  periodSeconds: 10
Unfortunately, it seems like…
         
    
    
        Kludge
        
- 2,653
- 4
- 20
- 42
                    3
                    
            votes
                
                3 answers
            
        How to create multi container pod from without yaml config of pod or deployment
Trying to figure out how do I create multicontainer pod from terminal with kubectl without yaml config of any resource 
tried kubectl run --image=redis --image=nginx but second --image just overrides the first one .. :)
         
    
    
        Chetanya Chopra
        
- 87
- 2
- 7
                    2
                    
            votes
                
                1 answer
            
        How to deploy a microservice ( possible multiple instances) dependent on database in the same kubernetes cluster?
I wanna run a microservice which use DB. DB need to deploy in the same kubernetes cluster as well using PVC/PV. What is the kubernetes service name/command to use to implement such logic:
Deploy the DB instance
If 1 is successful, then deploy the…
         
    
    
        J.J. Beam
        
- 2,612
- 2
- 26
- 55
                    2
                    
            votes
                
                1 answer
            
        Is there a way to automatically restart a pod deployment if a container is unhealthy
My kubernetes cluster has a pod deployment definition to have 10 pod copies. I ran into an issue where a pod instance's container will go into an unrecoverable state where the only mitigation I found is to restart the pod deployment through the…
         
    
    
        HDev
        
- 29
- 3
- 3
                    2
                    
            votes
                
                1 answer
            
        Is it possible to add a new Container once Pod is created?
Suppose I have created a Pod having 1 container, now I want to add a second container to it, how can I do that?
         
    
    
        pjj
        
- 2,015
- 1
- 17
- 42
                    2
                    
            votes
                
                2 answers
            
        How to keep redis database pod running in kubernetes
I created a pod which serve redis database and i want to leave it running when complete. Containers are meant to run to completion. Do i need to create and infinity loop which never ends ?
apiVersion: v1
kind: Pod
metadata:
  name: redis
spec:
 …
         
    
    
        O.Man
        
- 585
- 2
- 9
- 20
                    2
                    
            votes
                
                1 answer
            
        Do you need to define ports.containerPort in K8s if Dockerfile describes as EXPOSE
I have a legacy Deployment.yaml that is used by Helm and works fine so far.
      containers:
        ports:
          - containerPort: 3000
This part here was wrongly indended before. So the ports part of it wasn't active or used in k8s as far as…
         
    
    
        xetra11
        
- 7,671
- 14
- 84
- 159
                    2
                    
            votes
                
                2 answers
            
        Can we use single Volume mount in Pod for more than a single container?
In a pod can we have a single volume for two different containers.
         
    
    
        Kishan Jr
        
- 39
- 8
                    2
                    
            votes
                
                1 answer
            
        How to set Kubernetes image pull retry limit
Kubernetes ends up with long running pods when an image specified for a container is purged from an image repository.  These deployments are created by a continuous integration system and sometimes pipelines are run or rerun when images have been…
         
    
    
        bitrock
        
- 1,254
- 1
- 12
- 17
                    2
                    
            votes
                
                1 answer
            
        kubernetes - volume mapping via command
I need to map a volume while starting the container, I am able to do it so with yaml file. 
Is there an way volume mapping can be done via command line without using yaml file? just like
-v option in docker?
         
    
    
        Dhananjay
        
- 354
- 1
- 2
- 15
                    1
                    
            vote
                
                0 answers
            
        How to mark Pod as ready if one of the containers has completed
I have a Pod that has two regular (i.e. not Init) Containers. One of them is meant to be used as a "job", i.e. it should run a script and then exit while the other container should keep running. The problem is that as soon as the "job" container is…
         
    
    
        Mike
        
- 842
- 1
- 9
- 31
                    1
                    
            vote
                
                1 answer
            
        Unable to exec command into kubernetes pod
Python version 3.8.10
Kubernetes version 23.3.0
I'm trying to run a command into a specific pod in kubernetes using python. I've tried to reduce the code as much as I could, so I'm running this.
from kubernetes import client,…
         
    
    
        Xaruman
        
- 99
- 1
- 12