Changing the IP in my Kubernetes cluster from 10.32.0.0/12 to 172.31.0.0/18

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version:
Cloud being used: (put bare-metal if not on a public cloud) bare metal
Installation method: kubeadm
Host OS: Ubuntu 18.04.3 LTS
CNI and version: weave
CRI and version:
Hi,
I am trying to change the cidr for my kubernetes cluster which is using a weave cni plugin using cidr /18
curl -fsSLo weave-172subnet-daemonset.yaml "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d ‘\n’)&env.IPALLOC_RANGE=172.31.0.0/18"

Weave is installed and pods are up and running

The problem i am facing is when i deploy a jenkins as container it still doesnot point to new cidr

Name: jenkins-deployment-6c7d7949f4-97vmx
Namespace: default
Priority: 0
Node: k8s-jenkins-slave/10.41.80.43
Start Time: Wed, 17 Jun 2020 08:43:11 +0000
Labels: app=jenkins
pod-template-hash=6c7d7949f4

Status: Running
IP: 10.244.1.2
IPs:
IP:  **10.244.1.2**
Controlled By: ReplicaSet/jenkins-deployment-6c7d7949f4
Containers:
jenkins:
Container ID: docker://30438bbb9af92c319d084ad7216d39db5329332d70ecbfc66cbfc1a80d150e20
Image: jenkins/jenkins:2.222.3
Image ID: docker-pullable://jenkins/jenkins@sha256:15fca69266f4cc2107449d9fa2595acf0cbe1584eb425ee6f2fe9cefc9fc4b97
Ports: 8080/TCP, 50000/TCP
Host Ports: 0/TCP, 0/TCP
State: Running
when i describe the core dns  output is like this:

Name:                 coredns-66bff467f8-vfkcc
Namespace:            kube-system
Priority:             2000000000
Priority Class Name:  system-cluster-critical
Node:                 k8s-jenkins-master/10.41.80.44
Start Time:           Wed, 17 Jun 2020 07:50:54 +0000
Labels:               k8s-app=kube-dns
                      pod-template-hash=66bff467f8
Annotations:          <none>
Status:               Running
IP:                   **10.244.0.3**
IPs:
  IP:           **10.244.0.3**
Controlled By:  ReplicaSet/coredns-66bff467f8
Containers:
  coredns:
    Container ID:  /6baba323dcf59c6840fedcb08f3f6b553e01c96f3b5d91c7fd1a03345e5f0b73
    Image:         k8s.gcr.io/coredns:1.6.7
    Image ID:      docker-k8s.gcr.io/coredns@sha256:2c8d61c46f484d881db43b34d13ca47a269336e576c81cf007ca740fa9ec0800
    Ports:         53/UDP, 53/TCP, 9153/TCP
    Host Ports:    0/UDP, 0/TCP, 0/TCP
    Args:
      -conf
      /etc/coredns/Corefile
    State:          Running
      Started:      Wed, 17 Jun 2020 07:51:15 +0000
    Ready:          True
    Restart Count:  0
    Limits:
      memory:  170Mi
    Requests:
      cpu:        100m
      memory:     70Mi
    Environment:  <none>
    Mounts:
      /etc/coredns from config-volume (ro)
      /var/run/secrets/kubernetes.io/serviceaccount from coredns-token-dj6pn (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      coredns
    Optional:  false
  coredns-token-dj6pn:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  coredns-token-dj6pn
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  kubernetes.io/os=linux
Events:          <none>

However describing the weave pod contains the new cidr while setting it up
Can you please guide me where i am getting it wrong?

You would like to see the coredns ip addr change after installing weave?
That’s not possible coredns is different. Its manages cluster services and weave manages docker level networking. if i am wrong correct me.

the problem i am facing is when i deploy a jenkins as container it still doesnot point to new cidr

Name:         jenkins-deployment-6c7d7949f4-97vmx
Namespace:    default
Priority:     0
Node:         k8s-jenkins-slave/10.41.80.43
Start Time:   Wed, 17 Jun 2020 08:43:11 +0000
Labels:       app=jenkins
              pod-template-hash=6c7d7949f4
              
Status:       Running
IP:           10.244.1.2
IPs:
  IP:           **10.244.1.2**
Controlled By:  ReplicaSet/jenkins-deployment-6c7d7949f4
Containers:
  jenkins:
    Container ID:   docker://30438bbb9af92c319d084ad7216d39db5329332d70ecbfc66cbfc1a80d150e20
    Image:          jenkins/jenkins:2.222.3
    Image ID:       docker-pullable://jenkins/jenkins@sha256:15fca69266f4cc2107449d9fa2595acf0cbe1584eb425ee6f2fe9cefc9fc4b97
    Ports:          8080/TCP, 50000/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Running
      Started:      Wed, 17 Jun 2020 08:43:38 +0000
    Ready:          True
    Restart Count:  0
    Environment:
      JAVA_OPTS:            -Djenkins.install.runSetupWizard=false
      CASC_JENKINS_CONFIG:  /config-jcasc/jcasc.yml
    Mounts:
      /config-jcasc from jenkins-configmap-vol (rw)
      /var/jenkins_home from jenkins-home (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-srt2v (ro)
  prometheus-sidecar:
    Container ID:  docker://f3d5682dabdfa4bf6e1f13ac54b225d0ed5f642523c9842e9a5721df67032355
    Image:         quay.io/prometheus/node-exporter
    Image ID:      docker-pullable://quay.io/prometheus/node-exporter@sha256:cf66a6bbd573fd819ea09c72e21b528e9252d58d01ae13564a29749de1e48e0f
    Port:          9100/TCP
    Host Port:     0/TCP
    Args:
      --no-collector.arp
      --no-collector.bcache
      --no-collector.bonding
      --no-collector.buddyinfo
      --no-collector.conntrack
      --no-collector.cpu
      --no-collector.cpufreq
      --no-collector.diskstats
      --no-collector.drbd
      --no-collector.edac
      --no-collector.entropy
      --no-collector.filefd
      --no-collector.hwmon
      --no-collector.infiniband
      --no-collector.interrupts
      --no-collector.ipvs
      --no-collector.ksmd
      --no-collector.loadavg
      --no-collector.logind
      --no-collector.mdadm
      --no-collector.meminfo
      --no-collector.meminfo_numa
      --no-collector.mountstats
      --no-collector.netclass
      --no-collector.netdev
      --no-collector.netstat
      --no-collector.nfs
      --no-collector.nfsd
      --no-collector.ntp
      --no-collector.perf
      --no-collector.pressure
      --no-collector.processes
      --no-collector.qdisc
      --no-collector.runit
      --no-collector.sockstat
      --no-collector.stat
      --no-collector.supervisord
      --no-collector.systemd
      --no-collector.tcpstat
      --no-collector.textfile
      --no-collector.time
      --no-collector.timex
      --no-collector.uname
      --no-collector.vmstat
      --no-collector.wifi
      --no-collector.xfs
      --no-collector.zfs
    State:          Running
      Started:      Wed, 17 Jun 2020 08:43:47 +0000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /data/test from jenkins-home (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-srt2v (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  jenkins-home:
    Type:          HostPath (bare host directory volume)
    Path:          /home/arbs/jenkins-home
    HostPathType:  Directory
  jenkins-configmap-vol:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      jcasc-config
    Optional:  false
  default-token-srt2v:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-srt2v
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>

Events:          <none>