<p>I have requirement for two different version of elastic search, can I deploy two different pods of elastic search under same namespace in kubernetes cluster?</p>
<p>Dockerfile for elasticserach:</p>
<pre><code>FROM elasticsearch:7.12.0
USER elasticsearch
EXPOSE 9200
</code></pre>
<p>Second Dockerfile:</p>
<pre><code>FROM elasticsearch:7.5.1
USER elasticsearch
EXPOSE 9200
</code></pre>

SVD
<p>Yes you can.</p>
<p>If you want to deploy a bare pod</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: &quot;elastic search&quot;
  labels:
    app: &quot;eleastic-search&quot;
spec:
  containers:
    - name: &quot;eleastic-search&quot;
      image:  elasticsearch:7.12.0
      ports:
        - name: es
          containerPort: 9200
          protocol: TCP
</code></pre>
<p>for the second one you can use a different version and you need to use a different name</p>
<p>you can also use a deployment.
which will deploy 3 replicas of elasticsearch:7.12.0</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: &quot;elastic search&quot;
  labels:
    app: &quot;eleastic-search&quot;
spec:
  replicas: 3
  selector:
    matchLabels:
      app: &quot;eleastic-search&quot;
  template:
    metadata:
      labels:
        app: &quot;eleastic-search&quot;
    spec:
      containers:
      - name: &quot;eleastic-search&quot;
        image: elasticsearch:7.12.0
        ports:
        - containerPort: 9200
</code></pre>
<p>** make sure the metadata.name is not conflicting with each other.
both examples they will deployed in default namespace.
you can define namespace under the metadata section</p>
<p>I would recommend you to go through the offical docs of kubernetes
<a href="https://kubernetes.io/docs/concepts/workloads/pods/" rel="nofollow noreferrer">pods</a>
<a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">deployments</a>
<a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">services</a></p>
