Tuesday, 30 April 2024

##  How to regenerate cluster-agents.


kubectl patch clusters.management.cattle.io <REPLACE_WITH_CLUSTERID>--type=‘json’ -p=‘[{“op”: “replace”, “path”: “/status/apiEndpoint”,“” }, {“op”: “replace”, “path”: “/status/provider”,“”}, {“op”: “replace”, “path”: “/status/driver”,“” }]’ 


or 

kubectl patch clusters.management.cattle.io <REPLACE_WITH_CLUSTERID> -p '{"status":{"agentImage":"dummy"}}'



Also Check https://gist.github.com/superseb/076f20146e012f1d4e289f5bd1bd4971



Monday, 29 April 2024

 ## How to re-generate the  rancher-webhook 


1. Remove rancher.cattle.io validating and mutating webhooks, as well as the webhook service:
kubectl delete mutatingwebhookconfigurations rancher.cattle.io 
kubectl delete validatingwebhookconfigurations rancher.cattle.io
kubectl -n cattle-system delete service webhook-service

2. Navigate to Apps & Marketplace in the local cluster Explorer, Installed Apps, and
 perform an 'upgrade' of rancher-webhook to trigger the recreation of deleted resources 
and a new rancher-wehbook-tls certificate secret.

##  How to extend the RKE2 etcd db size


The default etcd size is 2 GB; when the etcd is almost complete, you can expand the etcd DB size.  To expand the etcd, at least the etcd is up and running.


From the Rancher UI, you can edit the RKE2 cluster and add etcd-arg under the


 MachineSelectorConfig.


machineSelectorConfig: - config: etcd-arg: - backend-quota-bytes=8589934592 kubelet-arg: - image-gc-high-threshold=85 - image-gc-low-threshold=80 protect-kernel-defaults: false



From the terminal:

you can add etcd-arg like below:

## $ cat /etc/rancher/rke2/config.yaml 
token: secret
etcd-arg:
  - "quota-backend-bytes=858993459"
  - "experimental-initial-corrupt-check=true"
  
$ journalctl -u rke2-server |grep quota
(or)
## If the config file is in the config.yaml.d
mkdir -p /etc/rancher/rke2/config.yaml.d
echo "etcd-arg+: ["backend-quota-bytes=8589934592"] > /etc/rancher/rke2/config.yaml.d/etcd-quota.yaml
systemctl restart rke2-server