简体   繁体   中英

Spin a local database with Kubernetes and Rancher

How do you change the cockroachdb YAML configuration from Rancher catalog that it will just

  • Use local disk (testing on a local computer)
  • Just use 1GB of disk space (should be enough for testing)

Here's the complete YAML

clusterDomain: cluster.local
conf:
  attrs: []
  cache: 25%
  cluster-name: ''
  disable-cluster-name-verification: false
  http-port: 8080
  join: []
  locality: ''
  logtostderr: INFO
  max-disk-temp-storage: 0
  max-offset: 500ms
  max-sql-memory: 25%
  port: 26257
  single-node: false
  sql-audit-dir: ''
image:
  credentials: {}
  pullPolicy: IfNotPresent
  repository: cockroachdb/cockroach
  tag: v20.1.3
ingress:
  annotations: {}
  enabled: false
  hosts: []
  labels: {}
  paths:
    - /
  tls: []
init:
  affinity: {}
  annotations: {}
  labels:
    app.kubernetes.io/component: init
  nodeSelector: {}
  resources: {}
  tolerations: []
labels: {}
networkPolicy:
  enabled: false
  ingress:
    grpc: []
    http: []
service:
  discovery:
    annotations: {}
    labels:
      app.kubernetes.io/component: cockroachdb
  ports:
    grpc:
      external:
        name: grpc
        port: 26257
      internal:
        name: grpc-internal
        port: 26257
    http:
      name: http
      port: 8080
  public:
    annotations: {}
    labels:
      app.kubernetes.io/component: cockroachdb
    type: ClusterIP
statefulset:
  annotations: {}
  args: []
  budget:
    maxUnavailable: 1
  env: []
  labels:
    app.kubernetes.io/component: cockroachdb
  nodeAffinity: {}
  nodeSelector: {}
  podAffinity: {}
  podAntiAffinity:
    type: soft
    weight: 100
  podManagementPolicy: Parallel
  priorityClassName: ''
  replicas: 3
  resources: {}
  secretMounts: []
  tolerations: []
  updateStrategy:
    type: RollingUpdate
storage:
  hostPath: ''
  persistentVolume:
    annotations: {}
    enabled: true
    labels: {}
    size: 100Gi
    storageClass: ''
tls:
  certs:
    clientRootSecret: cockroachdb-root
    nodeSecret: cockroachdb-node
    provided: false
    tlsSecret: false
  enabled: false
  init:
    image:
      credentials: {}
      pullPolicy: IfNotPresent
      repository: cockroachdb/cockroach-k8s-request-cert
      tag: '0.4'
  serviceAccount:
    create: true
    name: ''
Storage: 100Gi

Storage Size

It looks like Storage and store.persistentVolume.size can both be set to 1Gi if you are looking for one gigabyte of storage.

Local Storage

Then, I would check if you have a storageClass by running kubectl get storageClass . Many times, cluters come with the local-path-provisioner storageClass. If you have that, I would try setting store.persistentVolume.storageClass to the name of the local path proversion storageClass you have installed on your system. If you don't have that or an alternative, I would consider installing it.

More Info

I'm not certain, but it's possible that it is using this helm chart to install the database. This section of the chart deals with the volume claim managment, so I would look here if you need to do more troubleshooting: https://github.com/cockroachdb/helm-charts/blob/master/cockroachdb/templates/statefulset.yaml#L376

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM