Benutzer-Werkzeuge

Webseiten-Werkzeuge


it-wiki:kubernetes:change_calico_ip_pool

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
it-wiki:kubernetes:change_calico_ip_pool [2023/08/11 08:11] markoit-wiki:kubernetes:change_calico_ip_pool [2024/03/13 12:09] (aktuell) marko
Zeile 55: Zeile 55:
 If you follow these steps, existing pod connectivity will not be affected. (If you delete the old IP pool before you create and verify the new pool, existing pods will be affected.) When pods are deleted, applications may be temporarily unavailable (depending on the type of application); plan accordingly. If you follow these steps, existing pod connectivity will not be affected. (If you delete the old IP pool before you create and verify the new pool, existing pods will be affected.) When pods are deleted, applications may be temporarily unavailable (depending on the type of application); plan accordingly.
  
-  - Add a new IP pool. +  - Add a new IP pool.\\ It is highly recommended that your Calico IP pools are within the Kubernetes cluster CIDR. If pods IPs are allocated from outside of the Kubernetes cluster CIDR, some traffic flows may have NAT applied unnecessarily causing unexpected behavior.\\ 
- +  - Disable the old IP pool.\\ Disabling an IP pool only prevents new IP address allocations; it does not affect the networking of existing pods.\\ 
-It is highly recommended that your Calico IP pools are within the Kubernetes cluster CIDR. If pods IPs are allocated from outside of the Kubernetes cluster CIDR, some traffic flows may have NAT applied unnecessarily causing unexpected behavior. +  - Delete pods from the old IP pool. This includes any new pods that may have been created with the old IP pool prior to disabling the pool.\\ 
- +  - Verify that new pods get an address from the new IP pool.\\
-  - Disable the old IP pool. +
- +
-Disabling an IP pool only prevents new IP address allocations; it does not affect the networking of existing pods. +
- +
-  - Delete pods from the old IP pool. This includes any new pods that may have been created with the old IP pool prior to disabling the pool. +
- +
-  - Verify that new pods get an address from the new IP pool. +
   - Delete the old IP pool.   - Delete the old IP pool.
  
Zeile 87: Zeile 79:
 ==== Step 1: Add a new IP pool ==== ==== Step 1: Add a new IP pool ====
 We add a new **IPPool** with the CIDR range, **10.0.0.0/16**. We add a new **IPPool** with the CIDR range, **10.0.0.0/16**.
-<code bash>+<code yaml>
     apiVersion: projectcalico.org/v3     apiVersion: projectcalico.org/v3
     kind: IPPool     kind: IPPool
Zeile 115: Zeile 107:
 </code> </code>
  
-<code bash>+<code yaml>
     apiVersion: projectcalico.org/v3     apiVersion: projectcalico.org/v3
     items:     items:
Zeile 140: Zeile 132:
 Disable this IP pool by setting: ''disabled: true'' Disable this IP pool by setting: ''disabled: true''
  
-<code bash>+<code yaml>
     apiVersion: projectcalico.org/v3     apiVersion: projectcalico.org/v3
     kind: IPPool     kind: IPPool
Zeile 169: Zeile 161:
  
 ==== Step 3: Delete pods from the old IP pool ==== ==== Step 3: Delete pods from the old IP pool ====
 +Next, we delete all of the existing pods from the old IP pool. (In our example, coredns is our only pod; for multiple pods you would trigger a deletion for all pods in the cluster.)
 +<code bash>
 +kubectl delete pod -n kube-system coredns-6f4fd4bdf-8q7zp
 +</code>
 +
 +==== Step 4: Verify that new pods get an address from the new IP pool ====
 +  - Create a test namespace and nginx pod. <code bash>kubectl create ns ippool-test</code>
 +  - Create an nginx pod. <code bash>kubectl -n ippool-test create deployment nginx --image nginx</code>
 +  - Verify that the new pod gets an IP address from the new range. <code bash>kubectl -n ippool-test get pods -l app=nginx -o wide</code>
 +  - Clean up the ippool-test namespace. <code bash>kubectl delete ns ippool-test</code>
 +
 +==== Step 5: Delete the old IP pool ====
 +Now that you’ve verified that pods are getting IPs from the new range, you can safely delete the old pool.
 +<code bash>
 +calicoctl delete pool default-ipv4-ippool
 +</code>
it-wiki/kubernetes/change_calico_ip_pool.1691741518.txt.gz · Zuletzt geändert: 2023/08/11 08:11 von marko