Skip to content

Instantly share code, notes, and snippets.

View jenting's full-sized avatar
:octocat:

JenTing jenting

:octocat:
View GitHub Profile
@jenting
jenting / pod.yaml
Last active November 16, 2022 09:50
PreExisting Volume
apiVersion: v1
kind: Pod
metadata:
name: workspace-pod-test
namespace: default
spec:
restartPolicy: Always
containers:
- name: volume-pv-test
image: nginx:stable-alpine
@jenting
jenting / container.yaml
Last active November 10, 2022 06:00
Pod block device
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: block-dev
spec:
accessModes:
- ReadWriteOnce
volumeMode: Block
storageClassName: rook-ceph-block
resources:
@jenting
jenting / 0_before
Last active June 8, 2022 02:39
OSD Log
ubuntu@jenting-fi6ed5eb054c:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0
squash 4.0 0 100% /snap/core20/1405
loop1
squash 4.0 0 100% /snap/core18/2409
loop2
squash 4.0 0 100% /snap/google-cloud-sdk/243
loop3
squash 4.0 0 100% /snap/lxd/22923
@jenting
jenting / gcp-csi-volumesnapshot.log
Created June 7, 2022 07:45
CSI volume snapshot
$ k get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data-mysql-0 Bound pvc-ed1a2fba-a9fd-438c-818b-97d476ea39b3 8Gi RWO local-path 18m
minio Bound pvc-309d7f89-5543-4cd2-bdd2-9be1af2840bf 8Gi RWO local-path 18m
redis-data-openvsx-proxy-0 Bound pvc-71c1418b-ca28-49ad-9121-ab685468630a 8Gi RWO local-path 18m
registry Bound pvc-049d75c4-60c6-40c5-a29c-c4421d668f31 10Gi RWO local-path 18m
ws-1d836bec-d9c8-4387-94a9-c62de458068c Bound pvc-142f660d-572c-46d6-a3a1-54acb1bda82d 30Gi RWO csi-gce-pd 3m48s
$ k get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
@jenting
jenting / 1.txt
Created March 29, 2022 02:42
Controller Rate Limit
https://danielmangum.com/posts/controller-runtime-client-go-rate-limiting/
@jenting
jenting / 1.txt
Created March 29, 2022 02:20
CRD resources
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#upgrade-existing-objects-to-a-new-stored-version
https://github.com/kubernetes-sigs/kubebuilder/blob/72f7c2ef3fd42d21756bc04029ecc499daee2533/designs/crd_version_conversion.md
https://github.com/droot/crd-conversion-example
https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/webhook/conversion
@jenting
jenting / main.go
Created March 14, 2022 07:10
SHA512 checksum
package main
import (
"crypto/sha512"
"encoding/hex"
"flag"
"fmt"
"io"
"os"
@jenting
jenting / controller-gen.txt
Created November 11, 2021 07:04
controller gen help
CRD
+groupName package
=<string> specifies the API group name for this package.
+kubebuilder:deprecatedversion type
marks this version as deprecated.
[warning=<string>]
@jenting
jenting / build.sh
Created October 25, 2021 02:29
dapper build
make build; REPO=quay.io/jenting make package; cat ./bin/latest_image | xargs docker push
@jenting
jenting / daemonset-scaledown.md
Created September 15, 2021 04:23 — forked from ragul28/daemonset-scaledown.md
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'