> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions to Take When Server IP Address Changes

> When Apinizer server IP address changes, update Kubernetes Master and MongoDB configurations, regenerate certificates, and update replica set configuration.

## Actions for Kubernetes Master:

The following files need IP addresses changed:

```bash theme={null}
/etc/kubernetes/admin.conf
/etc/kubernetes/controller-manager.conf 
/etc/kubernetes/kubelet.conf
/etc/kubernetes/scheduler.conf
/etc/kubernetes/manifests/etcd.yaml
/etc/kubernetes/manifests/kube-apiserver.yaml
```

Existing certificates are deleted:

```bash theme={null}
cd /etc/kubernetes/pki
rm -rf apiserver.* apiserver-kubelet-client.*
```

New certificates are created (this stage may produce errors but they can be ignored):

```bash theme={null}
sudo kubeadm init phase certs apiserver-kubelet-client
sudo kubeadm init phase certs apiserver

sudo systemctl restart kubelet
```

The current config file is moved to the user's home directory for access:

```bash theme={null}
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
```

## Actions for MongoDB:

Connect to MongoDB:

```bash theme={null}
mongosh mongodb://<YOUR_NEW_MONGO_IP_ADDRESS>:25080 --authenticationDatabase "admin" -u "apinizer" -p
```

New IP settings are applied with the "force" option:

```javascript theme={null}
cfg = rs.conf()
cfg.members[0].host = "<YOUR_NEW_MONGO_IP_ADDRESS>:25080"
rs.reconfig(cfg, {force:true})
```
