<pre><code>apiVersion: v1
kind: Service
metadata:
   name: my-emp
   labels:
     run: my-emp
spec:
   ports:
   – port: 80
     protocol: TCP
     targetPort: 8888
   type: NodePort
   selector:
     run: my-emp
---
apiVersion: apps/v1
kind: Deployment
metadata:
   name: my-emp
spec:
   replicas: 2
   template:
     metadata:
       labels:
         run: my-emp
   spec:
     containers:
     – name: my-emp
       image: kavisuresh/employee
       ports:
       – containerPort: 8888
</code></pre>

harish hari
<p>The problem is that you have "–" (an <a href="https://www.fileformat.info/info/unicode/char/2013/index.htm" rel="nofollow noreferrer">en dash</a>) where you want "-" (a <a href="https://www.fileformat.info/info/unicode/char/2d/index.htm" rel="nofollow noreferrer">hyphen</a>).</p>

<p>I'm guessing you wrote this in a text editor that automatically does "smart" substitutions like <code>"</code> to <code>“</code>, and when you typed <code>-</code> you got <code>–</code> instead. If that's the case it will be worth your while to make sure those features are turned off, or switch to a "programmer's editor" like Visual Studio Code, Sublime Text, Atom, Vim, etc.</p>

<p>To fix the problem, replace the en dashes on lines 9, 28, and 31 with hyphens (and make sure your editor doesn't override them):</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
   name: my-emp
   labels:
     run: my-emp
spec:
   ports:
   - port: 80
     protocol: TCP
     targetPort: 8888
   type: NodePort
   selector:
     run: my-emp
---
apiVersion: apps/v1
kind: Deployment
metadata:
   name: my-emp
spec:
   replicas: 2
   template:
     metadata:
       labels:
         run: my-emp
   spec:
     containers:
     - name: my-emp
       image: kavisuresh/employee
       ports:
       - containerPort: 8888
</code></pre>
