Welcome to the Linux Foundation Forum!

LAB 11.1 - kubectl edit svc web -n linkerd-viz

Step 3. Im not able to make it work

kubectl edit svc web -n linkerd-viz

1 ....
2 ports:
3 - name: http
4 nodePort: 31500 #<-- Add line with an easy to remember port
5 port: 8084
6 ....
7 sessionAffinity: None
8 type: NodePort #<-- Edit type to be NodePort
9 status:
10 loadBalancer: {}
11 ....

I keep getting:
student@cp:~$ kubectl edit svc web -n linkerd-viz
error: services "web" is invalid
A copy of your changes has been stored to "/tmp/kubectl-edit-1683934773.yaml"
error: Edit cancelled, no valid changes were saved.

Answers

  • Maybe you can paste the entire block to see it clearly please.

  • egarfel
    egarfel Posts: 3
    edited October 2022

    I answer my selft. I spent some time understanding this part.

    Please edit the object below. Lines beginning with a '#' will be ignored,

    and an empty file will abort the edit. If an error occurs while saving this file will be

    reopened with the relevant failures.

    #
    apiVersion: v1
    kind: Service
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"linkerd.io/created-by":"linkerd/helm stable-2.12.1","linkerd.io/inject":"enabled"},"labels":{"component":"web","linkerd.io/extension":"viz","namespace":"linkerd-viz"},"name":"web","namespace":"linkerd-viz"},"spec":{"ports":[{"name":"http","port":8084,"targetPort":8084},{"name":"admin-http","port":9994,"targetPort":9994}],"selector":{"component":"web","linkerd.io/extension":"viz"},"type":"ClusterIP"}}
    linkerd.io/created-by: linkerd/helm stable-2.12.1
    linkerd.io/inject: enabled
    creationTimestamp: "2022-10-11T13:55:00Z"
    labels:
    component: web
    linkerd.io/extension: viz
    namespace: linkerd-viz
    name: web
    namespace: linkerd-viz
    resourceVersion: "2253457"
    uid: fb603b0a-ea27-421a-bfee-e010d66d318b
    spec:
    clusterIP: 10.102.184.93
    clusterIPs:
    - 10.102.184.93
    externalTrafficPolicy: Cluster
    internalTrafficPolicy: Cluster
    ipFamilies:
    - IPv4
    ipFamilyPolicy: SingleStack
    ports:
    - name: http
    nodePort: 31500
    port: 8084
    protocol: TCP
    targetPort: 8084
    - name: admin-http
    nodePort: 31422
    port: 9994
    protocol: TCP
    targetPort: 9994
    selector:
    component: web
    linkerd.io/extension: viz
    sessionAffinity: None
    ** type: NodePort**
    status:
    loadBalancer: {}

Categories

Upcoming Training