I must deploy a kubernetes cluster with tectonic for a client and I need a kuberenetes feature gate enabled, is that possible?
needed feature gate: https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/
needed for: https://www.arangodb.com/2018/03/arangodb-operator-kubernetes-stateful-cluster-deployments/
Kubernetes version: 1.9.6 (as provided by 1.9.6-tectonic.1)
You don't need to enable feature gate for using local-storage in kubernetes cluster after kubernetes 1.10.
You can directly use local-storage
same as any other storage class.
Please have a look at my following answer, how to setup local-storage
PV, PVC in kubernetes.
EDIT: As you're on kubernetes 1.9, you can do it this way:
You need to provide the feature-gates while starting the cluster using kubeadm init --config=config.yaml
to apiserver
, controller-manager
and scheduler
. Please refer following config:
apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
apiServerExtraArgs:
service-node-port-range: 80-32767
feature-gates: "PersistentLocalVolumes=true,VolumeScheduling=true,MountPropagation=true"
controllerManagerExtraArgs:
feature-gates: "PersistentLocalVolumes=true,VolumeScheduling=true,MountPropagation=true"
schedulerExtraArgs:
feature-gates: "PersistentLocalVolumes=true,VolumeScheduling=true,MountPropagation=true"
Then you need to create your own storage class, as there is no local-storage class present. So create your own class as follow:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage-data
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
Now you can create your PV and PVC in following way:
PV Definition:
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-mariadb-0
labels:
pod-name: mariadb-0
annotations:
"volume.alpha.kubernetes.io/node-affinity": '{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{ "matchExpressions": [
{ "key": "kubernetes.io/hostname",
"operator": "In",
"values": ["prod-mysql-0"]
}
]}
]}}'
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage-data
local:
path: /mnt/local-storage/mysql-data-0
PVC definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: mariadb
name: mysql-mariadb-0
namespace: mysql
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: local-storage-data
selector:
matchLabels:
pod-name: mariadb-0
Is it possible to mount different pods to the same portion of a local persistent volume?
Hope this helps