chore(kubectl): add kubectl diff command snippets

This commit is contained in:
Michele Cereda
2025-08-16 21:57:05 +02:00
parent 31057ad192
commit 9089c3c981
4 changed files with 20 additions and 2 deletions

View File

@@ -790,7 +790,7 @@ kubectl exec -it 'app' -- cat '/data/out.txt'
kubectl delete -f 'manifests/'
```
'gp2' seem to still be the default EBS type at the time of writing.<br/>
`gp2` seem to still be the default EBS volume type at the time of writing.<br/>
Though it seems to be possible to add storage custom storage classes to the values file for the EBS CSI driver's helm
chart, this is not configurable from the AWS-managed add-on.
@@ -1291,6 +1291,12 @@ Requirements:
git clone 'https://github.com/kubernetes-csi/external-snapshotter.git'
kubectl kustomize 'external-snapshotter/client/config/crd' | kubectl apply -f -
kubectl -n 'kube-system' kustomize 'external-snapshotter/deploy/kubernetes/snapshot-controller' | kubectl apply -f -
# or, without cloning:
kubectl kustomize 'https://github.com/kubernetes-csi/external-snapshotter/client/config/crd' | kubectl apply -f -
kubectl -n 'kube-system' kustomize \
'https://github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/snapshot-controller' \
| kubectl apply -f -
```
</details>

View File

@@ -54,7 +54,8 @@ docker run -p '9090:9090' -v "$PWD/config/dir:/etc/prometheus" -v 'prometheus-da
helm repo add 'prometheus-community' 'https://prometheus-community.github.io/helm-charts' \
&& helm repo update 'prometheus-community'
helm show values 'prometheus-community/prometheus'
helm search repo --versions 'prometheus-community/prometheus'
helm show values --version '27.30.0' 'prometheus-community/prometheus'
helm --namespace 'prometheus' upgrade --install --create-namespace 'prometheus' 'prometheus-community/prometheus'
helm --namespace 'prometheus' upgrade --install --create-namespace 'prometheus' \
@@ -62,6 +63,9 @@ helm --namespace 'prometheus' upgrade --install --create-namespace 'prometheus'
--set 'prometheus-pushgateway.enabled=false' --set 'alertmanager.enabled=false' \
--set 'server.persistentVolume.enabled=false'
helm --namespace 'prometheus' diff upgrade 'prometheus' 'prometheus-community/prometheus' \
--version '27.30.0' --values 'values/prometheus.yml'
kubectl -n 'prometheus' get pods -l 'app.kubernetes.io/name=prometheus,app.kubernetes.io/instance=prometheus' \
-o jsonpath='{.items[0].metadata.name}' \
| xargs -I '%%' kubectl -n 'prometheus' port-forward "%%" '9090'

View File

@@ -111,3 +111,6 @@ helm template 'chartName' \
# Check that the 'backend.url key' in a 'Pulumi.yaml' file is not 'file://' and fail otherwise
yq -e '(.backend.url|test("^file://")?)|not' 'Pulumi.yaml'
# Apply formatting to the same file you read from
yq -iY --explicit-start '.' 'external-snapshotter/crds.yml'

View File

@@ -84,3 +84,8 @@ POD_NAME='gitlab-runner-6ddd58fcb6-c9swk' POD_NAMESPACE='gitlab' \
&& kubectl get pods -n "$POD_NAMESPACE" "$POD_NAME" -o jsonpath='{.status.hostIP}' | tr '.' '-' \
| xargs -I '%%' kubectl get --raw '/api/v1/nodes/ip-%%.eu-west-1.compute.internal/proxy/stats/summary' \
| jq --arg 'podName' "$POD_NAME" '.pods[] | select(.podRef.name == $podName)."ephemeral-storage"'
# Show changes from the live version against a would-be applied version
kubectl kustomize 'https://github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/snapshot-controller' \
| kubectl diff -f -
kubectl diff -k 'external-snapshotter'