0

I wanted to update the deployed configmap through the kubectl patch command, but I was not familiar with the patch syntax. After trying, I found that it did not take effect

This is my configmap

apiVersion: cloudcore.config.kubeedge.io/v1alpha2
kind: CloudCore
kubeAPIConfig:
  kubeConfig: ""
  master: ""
modules:
  cloudHub:
    advertiseAddress:
    - 10.102.26.35
    dnsNames:
    - 
    nodeLimit: 1000
    tlsCAFile: /etc/kubeedge/ca/rootCA.crt
    tlsCertFile: /etc/kubeedge/certs/edge.crt
    tlsPrivateKeyFile: /etc/kubeedge/certs/edge.key
    unixsocket:
      address: unix:///var/lib/kubeedge/kubeedge.sock
      enable: true
    websocket:
      address: 0.0.0.0
      enable: true
      port: 10000
    quic:
      address: 0.0.0.0
      enable: false
      maxIncomingStreams: 10000
      port: 10001
    https:
      address: 0.0.0.0
      enable: true
      port: 10002
  cloudStream:
    enable: true
    streamPort: 10003
    tunnelPort: 10004
  dynamicController:
    enable: false
  router:
    enable: false
  iptablesManager:
    enable: true
    mode: external

I want to replace the 10.102.26.35 ip with 192.168.1.20

I tried to use the following command, but it didn't work, someone can help me

kubectl patch configmap cloudcore -n kubeedge --type merge -p '{"data":{"advertiseAddress":"[\"10.102.26.35\", \"192.168.1.20\"]"}}'
zccharts
  • 41
  • 7
  • Can you try editing the deployment using `kubectl edit deployment` and replace the IP 10.102.26.35 with 192.168.1.20, then apply the changes using `kubectl apply` – Hemanth Kumar Dec 20 '22 at 08:13
  • Do not want to use edit, or modify yaml files, want to go through patch – zccharts Dec 20 '22 at 08:48

1 Answers1

1

As per this SO There is no way to add without replace. Configmaps does not understand structure data. This you need to do by manually.

Refer to this SO and Doc for more information

Hemanth Kumar
  • 2,728
  • 1
  • 4
  • 19