Skip to content

Instantly share code, notes, and snippets.

@mauilion
Last active December 14, 2023 16:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mauilion/1b5727f42d181f36bb934656fa50459a to your computer and use it in GitHub Desktop.
Save mauilion/1b5727f42d181f36bb934656fa50459a to your computer and use it in GitHub Desktop.
kubectl describe configmaps -n local-path-storage local-path-config
Name: local-path-config
Namespace: local-path-storage
Labels: <none>
Annotations:
Data
====
config.json:
----
{
"nodePathMap":[
{
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
"paths":["/var/local-path-provisioner"]
}
]
}
Events: <none>
---
apiVersion: v1
kind: Namespace
metadata:
name: local-storage
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hostpath-provisioner
namespace: local-storage
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: local-storage
roleRef:
kind: ClusterRole
name: hostpath-provisioner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: local-storage
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["list", "watch", "create"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: local-storage
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: local-storage
roleRef:
kind: Role
name: leader-locking-hostpath-provisioner
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hostpath-provisioner
namespace: local-storage
labels:
app: hostpath-provisioner
spec:
replicas: 3
selector:
matchLabels:
app: hostpath-provisioner
template:
metadata:
labels:
app: hostpath-provisioner
spec:
containers:
- name: hostpath-provisioner
image: mauilion/hostpath-provisioner:dev
imagePullPolicy: "IfNotPresent"
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: pv-volume
mountPath: /tmp/hostpath-provisioner
serviceAccountName: hostpath-provisioner
volumes:
- name: pv-volume
hostPath:
path: /tmp/hostpath-provisioner
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
reclaimPolicy: Retain
provisioner: example.com/hostpath
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
extraMounts:
- hostPath: ./shared-storage
containerPath: /var/local-path-provisioner
- role: worker
extraMounts:
- hostPath: ./shared-storage
containerPath: /var/local-path-provisioner
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: ./kind-pvc-hostpath.yaml
containerPath: /kind/manifests/default-storage.yaml
- hostPath: /tmp/hostpath-provisioner
containerPath: /tmp/hostpath-provisioner
- role: worker
extraMounts:
- hostPath: /tmp/hostpath-provisioner
containerPath: /tmp/hostpath-provisioner
- role: worker
extraMounts:
- hostPath: /tmp/hostpath-provisioner
containerPath: /tmp/hostpath-provisioner
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: ./shared
containerPath: /tmp/shared
- role: worker
extraMounts:
- hostPath: ./shared
containerPath: /tmp/shared
- role: worker
extraMounts:
- hostPath: ./shared
containerPath: /tmp/shared
---
apiVersion: v1
kind: Namespace
metadata:
name: local-storage
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hostpath-provisioner
namespace: local-storage
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: local-storage
roleRef:
kind: ClusterRole
name: hostpath-provisioner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: local-storage
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["list", "watch", "create"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: local-storage
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: local-storage
roleRef:
kind: Role
name: leader-locking-hostpath-provisioner
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hostpath-provisioner
namespace: local-storage
labels:
app: hostpath-provisioner
spec:
replicas: 3
selector:
matchLabels:
app: hostpath-provisioner
template:
metadata:
labels:
app: hostpath-provisioner
spec:
containers:
- name: hostpath-provisioner
image: mauilion/hostpath-provisioner:dev
imagePullPolicy: "IfNotPresent"
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: pv-volume
mountPath: /tmp/hostpath-provisioner
serviceAccountName: hostpath-provisioner
volumes:
- name: pv-volume
hostPath:
path: /tmp/hostpath-provisioner
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
reclaimPolicy: Retain
provisioner: example.com/hostpath
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/tmp/shared/somedata"
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: name
image: nginx
imagePullPolicy: Always
ports:
- containerPort: 80
volumeMounts:
- name: volume
mountPath: /pvc/
volumes:
- name: volume
persistentVolumeClaim:
claimName: test
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
labels:
# insert any desired labels to identify your claim
app: test
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
# The amount of the volume's storage to request
storage: 2Gi
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: manual
provisioner: manual
reclaimPolicy: Retain
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: name
image: nginx
imagePullPolicy: Always
ports:
- containerPort: 80
volumeMounts:
- name: volume
mountPath: /pvc/
volumes:
- name: volume
persistentVolumeClaim:
claimName: test
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
labels:
# insert any desired labels to identify your claim
app: test
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
# The amount of the volume's storage to request
storage: 2Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment