<p>In order to access the Kubernetes Dashboard remotely, I have tried to replace the <code>ClusterIP</code> with <code>nodePort</code> as recomended <a href="https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/54130046/how-can-i-access-to-kubernetes-dashboard-using-nodeport-in-a-remote-cluster-for">here</a>. However the edit always fails with the following error:</p>

<pre><code>Invalid value: "The edited file failed validation": ValidationError(Service.spec): unknown field "nodePort" in io.k8s.api.core.v1.ServiceSpec
</code></pre>

<p>The command recommended by the references above is:</p>

<pre><code>kubectl edit svc/kubernetes-dashboard --namespace=kube-system
</code></pre>

<p>Here is the <code>yaml</code> what I was trying after changing:</p>

<pre><code>apiVersion: v1
kind: Service
metadata
  creationTimestamp: "2019-07-24T13:03:48Z"
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
  resourceVersion: "2238"
  selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard
  uid: 79c37d2b-ae13-11e9-b2a1-0026b95c3009
spec:
  NodePort: 10.110.154.246
  ports:
    - port: 80
    protocol: TCP
    targetPort: 9090
 selector:
    k8s-app: kubernetes-dashboard
 sessionAffinity: None
 type: ClusterIP
status:
  loadBalancer: {}
</code></pre>

<p>And the output of client and server version is as follows:</p>

<pre><code>   $kubectl version
   Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:35:51Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
   Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.8", GitCommit:"0c6d31a99f81476dfc9871ba3cf3f597bec29b58", GitTreeState:"clean", BuildDate:"2019-07-08T08:38:54Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>You were using the wrong configuration. There is no field in the <code>spec</code> of Kubernetes Service named <code>NodePort</code>. The doc you shared told you to change the value of the field <code>spec.type</code> from <code>ClusterIP</code> to <code>NodePort</code>. On the hand, you are adding a new field <code>spec.NodePort</code> which is totally invalid. See, <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#nodeport</a></p>

<p>Try like this, while doing <code>kubectl edit</code>:</p>

<pre><code>apiVersion: v1
kind: Service
metadata
  ...
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
  ...
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 9090
 ...
 type: NodePort
...
</code></pre>

<p>Or just run this:</p>

<pre><code>kubectl get svc -n kube-system kubernetes-dashboard -o yaml | sed 's/type: ClusterIP/type: NodePort/' | kubectl replace -f - 
</code></pre>
