<p>I am trying to create a service on <code>kubernetes</code> but although no error is printed, I am unable to list the service;</p>

<p>working locally with <code>minikube</code></p>

<pre><code>*$ kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   4h
/home/pkara/Workspace/gitlab/my-minikube
*$ kubectl apply -f mydb.yaml 
service/mydatabase unchanged
/home/pkara/Workspace/gitlab/my-minikube
*$ kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   4h
</code></pre>

<p>Here is the manifest used:</p>

<pre><code>---

apiVersion: v1
kind: Service
metadata:
  name: mydatabase
  namespace: esa-local-dev
  labels:
    app: mydatabase
spec:
  ports:
  - name: mydatabase-port
    port: 3306
    targetPort: 3306
  selector:
    app: mydatabase
  clusterIP: None

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mydatabase-deployment
  labels:
    app: mydatabase
spec:
  selector:
    matchLabels:
      app: mydatabase
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mydatabase
    spec:
      containers:
      - name: mysql
        image: mysql:5.7
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "root"
        - name: MYSQL_DATABASE
          value: "mydatabase"
        - name: MYSQL_USER
          value: "mydatabase"
        - name: MYSQL_PASSWORD
          value: "mydatabase"
        ports:
        - containerPort: 3306
          name: mysql
      restartPolicy: Always
</code></pre>

pkaramol
<p>The Service is created on <code>esa-local-dev</code> namespace. In your yaml, you have:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: mydatabase
  namespace: esa-local-dev
...
</code></pre>

<p>You can see the service by running,</p>

<pre><code>$ kubectl get services -n esa-local-dev
</code></pre>
