title: How can I convert ClusterIp to NodePort in Kubernetes?
body: <p>I am trying to convert from ClusterIp to NodePort. But When I call via curl <a href="http://176.55.116.xxx:30100" rel="nofollow noreferrer">http://176.55.116.xxx:30100</a> . It creates the below error. How can I convert below from clusterIp to Nodeport version?</p>
  <p><a href="https://i.stack.imgur.com/wjkCb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wjkCb.png" alt="Unable o connect to remote server when using curl to call http://176.55.116.116:30100" /></a> below configuration is not working...</p>
  <p>**(1) ClusterIp version (deployment_service.yml) [WORKING] **</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    namespace: coturn
    name: coturn
    labels:
      app.kubernetes.io/name: coturn
      app.kubernetes.io/instance: coturn
      app.kubernetes.io/version: 0.0.1
  spec:
    # replicas: 1
    selector:
      matchLabels:
            app.kubernetes.io/name: coturn
            app.kubernetes.io/instance: coturn
            app.kubernetes.io/version: 0.0.1
    template:
      metadata:
        labels:
              app.kubernetes.io/name: coturn
              app.kubernetes.io/instance: coturn
              app.kubernetes.io/version: 0.0.1
      spec:
        hostNetwork: true
        # securityContext:
        #   runAsUser: 1000
        #   runAsGroup: 1000
        containers:
          - name: coturn
            image: coturn/coturn
            imagePullPolicy: Always
            ports:
              # - name: turn-udp
              #   containerPort: 3000
              #   protocol: UDP
              - name: turn-port1
                containerPort: 3478
                hostPort: 3478
                protocol: UDP
              - name: turn-port2
                containerPort: 3478
                hostPort: 3478
                protocol: TCP
            # securityContext:
            #   capabilities:
            #     drop:
            #       - ALL
              # readOnlyRootFilesystem: true
              # allowPrivilegeEscalation: false
            args:
            #   - --stun-only
              - -v
  
  --- 
  
  apiVersion: v1
  kind: Service
  metadata:
    name: coturn
    namespace: coturn
    labels:
         app.kubernetes.io/name: coturn
         app.kubernetes.io/instance: coturn
         app.kubernetes.io/version: 0.0.1
  spec:
    type: ClusterIP
    ports:
      # - port: 3000
      #   targetPort: 3000
      #   protocol: UDP
      #   name: turn-udp
      - port: 3478
        targetPort: 3478
        protocol: UDP
        name: turn-port1
      - port: 3478
        targetPort: 3478
        protocol: TCP
        name: turn-port2
      # - port: 3478
      #   targetPort: 3478
      #   protocol: TCP
      #   name: turn-port3
      # - port: 3479
      #   targetPort: 3479
      #   protocol: TCP
      #   name: turn-port4
      
    selector:
         app.kubernetes.io/name: coturn
         app.kubernetes.io/instance: coturn
         app.kubernetes.io/version: 0.0.1</code></pre>
  </div>
  </div>
  </p>
  <p><strong>(2) NodePort version (deployment_service.yml) :   (NOT WORKInG)</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    namespace: coturn
    name: coturn
    labels:
      app.kubernetes.io/name: coturn
      app.kubernetes.io/instance: coturn
      app.kubernetes.io/version: 0.0.1
  spec:
    # replicas: 1
    selector:
      matchLabels:
            app.kubernetes.io/name: coturn
            app.kubernetes.io/instance: coturn
            app.kubernetes.io/version: 0.0.1
    template:
      metadata:
        labels:
              app.kubernetes.io/name: coturn
              app.kubernetes.io/instance: coturn
              app.kubernetes.io/version: 0.0.1
      spec:
        hostNetwork: true
        # securityContext:
        #   runAsUser: 1000
        #   runAsGroup: 1000
        containers:
          - name: coturn
            image: coturn/coturn
            imagePullPolicy: Always
            ports:
              # - name: turn-udp
              #   containerPort: 3000
              #   protocol: UDP
              - name: turn-port1
                containerPort: 3478
                hostPort: 3478
                protocol: UDP
              - name: turn-port2
                containerPort: 3478
                hostPort: 3478
                protocol: TCP
            # securityContext:
            #   capabilities:
            #     drop:
            #       - ALL
              # readOnlyRootFilesystem: true
              # allowPrivilegeEscalation: false
            args:
            #   - --stun-only
              - -v
  
  --- 
  
  apiVersion: v1
  kind: Service
  metadata:
    name: coturn
    namespace: coturn
    labels:
         app.kubernetes.io/name: coturn
         app.kubernetes.io/instance: coturn
         app.kubernetes.io/version: 0.0.1
  spec:
    type: NodePort
    ports:
      # - port: 3000
      #   targetPort: 3000
      #   protocol: UDP
      #   name: turn-udp
      - port: 3478
        targetPort: 3478
        nodePort: 30100
        protocol: UDP
        name: turn-port1
      - port: 3478
        targetPort: 3478
        nodePort: 30100
        protocol: TCP
        name: turn-port2
      selector:
        app: coturn
      # - port: 3478
      #   targetPort: 3478
      #   protocol: TCP
      #   name: turn-port3
      # - port: 3479
      #   targetPort: 3479
      #   protocol: TCP
      #   name: turn-port4
  status:
    loadBalancer: {}
      </code></pre>
  </div>
  </div>
  </p>
  <p><strong>Error:</strong></p>
  <pre class="lang-sh prettyprint-override"><code>yusuf@DESKTOP-QK5VI8R:~/turnserver$ kubectl apply -f deploy.yml
  daemonset.apps/coturn created
  error: error parsing deploy.yml: error converting YAML to JSON: yaml: line 27: did not find expected '-' indicator
  </code></pre>