Skip to content

Commit

Permalink
chore: Tidy
Browse files Browse the repository at this point in the history
Signed-off-by: Scotte Zinn <[email protected]>
  • Loading branch information
szinn committed Jan 15, 2025
1 parent 77455fc commit 74addd4
Showing 1 changed file with 10 additions and 65 deletions.
75 changes: 10 additions & 65 deletions .taskfiles/kubernetes/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,74 +29,19 @@ tasks:

alpine:
desc: Run alpine container
cmds:
- kubectl run -it alpine --image alpine:3.15.4
cmd: "{{.ROOT_DIR}}/hack/ashell.sh"

dnsutils:
desc: Run DNSUtils pod
cmds:
- kubectl run -it dnsutils --image gcr.io/kubernetes-e2e-test-images/dnsutils:1.3
ubuntu:
desc: Run ubuntu container
cmd: "{{.ROOT_DIR}}/hack/ushell.sh"

netshoot:
desc: Run netshoot pod
cmd: kubectl netshoot --context {{.cluster}} run netshoot
vars:
cluster: '{{.cluster | default "main"}}'

what-dockerhub:
desc: What dockerhub images are running in my cluster
cmds:
- kubectl get pods --all-namespaces -o=jsonpath="{range .items[*]}{'\n'}{range .spec.containers[*]}{.image}{'\n'}{end}{end}" | sort | uniq | grep -Ev 'quay|gcr|ghcr|ecr|us-docker' | grep -Ev 'bitnami|rook|intel|grafana' | sed -e 's/docker\.io\///g' | sort | uniq

debug-networking:
desc: Create a netshoot container for debugging
cmds:
- kubectl run tmp-shell --rm -i --tty --image docker.io/nicolaka/netshoot:latest {{.CLI_ARGS}}

debug-volume:
desc: Attach a volume to a container for debugging, ex. VOLUME=zigbee2mqtt-config-v1 NAMESPACE=home task debug-volume
interactive: true
cmds:
- defer: kubectl -n ${NAMESPACE} delete pod debug-${VOLUME}
- |
cat <<EOF | kubectl apply -f -
kind: Pod
apiVersion: v1
metadata:
name: "debug-${VOLUME}"
namespace: "${NAMESPACE}"
labels:
volume: "${VOLUME}"
spec:
containers:
- name: debug
image: docker.io/library/alpine:3.21@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099
command: ["/bin/sh"]
tty: true
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- apk add --no-cache curl nano
volumeMounts:
- name: data
mountPath: /data
- name: backups
mountPath: /mnt/backups
volumes:
- name: data
persistentVolumeClaim:
claimName: "${VOLUME}"
- name: backups
nfs:
server: "hades"
path: "/volume1/K8S/main"
EOF
- kubectl -n $NAMESPACE wait --for=condition=ready pod -l volume=$VOLUME
- kubectl -n $NAMESPACE exec (kubectl get pod -n $NAMESPACE -l volume=$VOLUME -o name) -it debug -- /bin/sh

restart-loki:
desc: Restart loki deployment
cmds:
- kubectl --context main rollout restart deployment -n observability loki-gateway
- kubectl --context main rollout restart deployment -n observability loki-read
- kubectl --context main rollout restart statefulset -n observability loki-backend
- kubectl --context main rollout restart statefulset -n observability loki-chunks-cache
- kubectl --context main rollout restart statefulset -n observability loki-results-cache
- kubectl --context main rollout restart statefulset -n observability loki-write

0 comments on commit 74addd4

Please sign in to comment.