Very new to kubernetes. I've been getting confused by documentation and example differences between Helm2 and 3.
I installed the stable/nginx-ingress
chart via helm install app-name stable/nginx-ingress
.
1st question:
I need to update the externalTrafficPolicy
to Local
. I learned later I could have set that during the install process via adding --set controller.service.externalTrafficPolicy=Local
to the helm command.
How can I update the LoadBalancer service with the new setting without removing the ingress controller and reinstalling?
2nd question:
Helm3 just downloaded and setup the ingress controller and didn't save anything locally. Is there a way to backup all my my k8s cluster configs (other than the ones I've created manually)?
Is there a way to backup all my my k8s cluster configs
kubectl cluster-info dump
shows some info about the k8s cluster./etc/kubernetes/
on the master node.I've been able to dump manifests of all resources in all namespaces in k8s using the following bash script, please edit as needed:
#!/usr/bin/env bash
while read -r line
do
output=$(kubectl get "$line" --all-namespaces -o yaml 2>/dev/null | grep '^items:')
if ! grep -q "\[\]" <<< $output; then
echo -e "\n======== "$line" manifests ========\n"
kubectl get "$line" --all-namespaces -o yaml
fi
done < <(kubectl api-resources | awk '{print $1}' | grep -v '^NAME')
Above bash script was tested with:
v1.16.3
18.04.3
OSversion 4.4.20(1)-release (x86_64-pc-linux-gnu)
I suggest not to use the dump/manifests of an existing k8s cluster to create a new k8s cluster, just refer them as backup, and use an installer like Kubeadm to re-install k8s.
I've been getting confused by documentation and example differences between Helm2 and 3.
If you're interested, check helm-2to3 tool - it migrates configs and data from helm 2 to helm 3 using a command like helm 2to3 move config
.
To upgrade and dump the YAML deployed (for a backup of the ingress release)
helm upgrade <your-release-name> stable/nginx-ingress \
--reuse-values \
--set controller.service.externalTrafficPolicy=Local \
--output yaml
For a public chart you may want to set the --version
option to the existing installed version of the chart you used. In case you don't want to any updates from newer versions to be applied along with the setting.
For complete dumps, have a look through this github issue. All options there are a bit dodge though with edge cases. I would recommend having everything re-deployable from something like git, all the way from cluster to apps. Anyone who makes edits by hand can then be shot (Well.. at least have clusters regularly redeployed on them :)