<p>i'm having an hard time to start learning kubernetes the documentations isn't really simple i want to realize simple trick for the moment i'm familliar with docker and i wan't to learn orchestration with kubernetes .
i've realized the following yml file :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
spec:
  selector:
    matchLabels:
      app: test
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: ubuntu:20.04
        command: [&quot;/scripts/ubuntu.sh&quot;]
        ports:
        - containerPort: 80
        - containerPort: 443
        volumeMounts:
        - name: scripts
          mountPath: /scripts
      volumes:
      - name: scripts
        configMap:
          name: scripts
          defaultMode: 0744
</code></pre>
<p>in my sh file i've got the following :</p>
<pre><code>#!/bin/sh
apt install -y apache2 &amp;&amp; service apache2 start &amp;&amp; tail -f /dev/null
</code></pre>
<p>the idea is to launch an ubuntu , install apache2 , start the service , keep container alive with a tail , and being able to go on the mapped 80 port from container to my host .</p>
<p>i think i'm doing something wrong when i launch kubectl apply -f i get :
<code>deployment.apps/test-deployment created</code>
but nothing up on my localhost unfortunatly ...</p>
<p>anyone already had that problem ?</p>
<p>PS: i'm using docker desktop on windows .</p>
<p>Edit :</p>
<p>Now i got my pods running but i cannot access my apache on localhost:80 heres my actual config :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: apache
spec:
  selector:
    matchLabels:
      app: test
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: ubuntu:20.04
        command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;apt update -y &amp;&amp; apt install -y apache2 &amp;&amp; service apache2 start &amp;&amp; tail -f /dev/null&quot;]
        ports:
        - name: http
          containerPort: 80
        env:
        - name: DEBIAN_FRONTEND
          value: noninteractive
---
apiVersion: v1
kind: Service
metadata:
  name: apache-service
spec:
  selector:
    app: apache
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 30001
</code></pre>

kevP-Sirius
<p>Problem Fixed :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: apache
spec:
  selector:
    matchLabels:
      app: test
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: ubuntu:20.04
        command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;apt update -y &amp;&amp; apt install -y apache2 &amp;&amp; service apache2 start &amp;&amp; tail -f /dev/null&quot;]
        ports:
        - name: http
          containerPort: 80
        env:
        - name: DEBIAN_FRONTEND
          value: noninteractive
---
apiVersion: v1
kind: Service
metadata:
  name: apache-service
spec:
  selector:
    app: test
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 80
    targetPort: http
    # nodePort: 30001
</code></pre>
<p>my problem was coming from the selector in service that i was using wrongly i'll check how it work exactly but now i'm having my service providing my ubuntu with apache on localhost perfectly .</p>
<p>Edit :
After checking i've uncomment the <code>selector: app : test</code> under spec service , because it wasn't working without it now everything ok !</p>
