使用Helm在Kubernetes上部署GitLab

时间:2018-05-29 19:55:36

标签: kubernetes gitlab kubernetes-helm

我需要在Kubernetes上使用Helm部署GitLab。 我有问题:PVC正在等待。

我在PVC说明中看到volume.alpha.kubernetes.io/storage-class: default,但我在values.yaml中设置了值gitlabDataStorageClass: gluster-heketi。 我很好地从文章https://github.com/gluster/gluster-kubernetes/blob/master/docs/examples/hello_world/README.md部署简单的nginx 是的,我使用分发存储GlusterFS https://github.com/gluster/gluster-kubernetes

# kubectl get pvc
NAME                  STATUS    VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS     AGE
gitlab1-gitlab-data   Pending                                                                                         19s
gitlab1-gitlab-etc    Pending                                                                                         19s
gitlab1-postgresql    Pending                                                                                         19s
gitlab1-redis         Pending                                                                                         19s
gluster1              Bound     pvc-922b5dc0-6372-11e8-8f10-4ccc6a60fcbe   5Gi        RWO            gluster-heketi   43m

单一的痛苦结构:

# kubectl get pvc gitlab1-gitlab-data -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    volume.alpha.kubernetes.io/storage-class: default
  creationTimestamp: 2018-05-29T19:43:18Z
  finalizers:
  - kubernetes.io/pvc-protection
  name: gitlab1-gitlab-data
  namespace: default
  resourceVersion: "263950"
  selfLink: /api/v1/namespaces/default/persistentvolumeclaims/gitlab1-gitlab-data
  uid: 8958d4f5-6378-11e8-8f10-4ccc6a60fcbe
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
status:
  phase: Pending

在描述中我看到:

# kubectl describe pvc gitlab1-gitlab-data
Name:          gitlab1-gitlab-data
Namespace:     default
StorageClass:
Status:        Pending
Volume:
Labels:        <none>
Annotations:   volume.alpha.kubernetes.io/storage-class=default
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
Events:
  Type    Reason         Age                From                         Message
  ----    ------         ----               ----                         -------
  Normal  FailedBinding  2m (x43 over 12m)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

我的values.yaml文件:

# Default values for kubernetes-gitlab-demo.
# This is a YAML-formatted file.

# Required variables

# baseDomain is the top-most part of the domain. Subdomains will be generated
# for gitlab, mattermost, registry, and prometheus.
# Recommended to set up an A record on the DNS to *.your-domain.com to point to
# the baseIP
# e.g. *.your-domain.com.    A    300    baseIP
baseDomain: my-domain.com

# legoEmail is a valid email address used by Let's Encrypt. It does not have to
# be at the baseDomain.
legoEmail: my@mail.com

# Optional variables
# baseIP is an externally provisioned static IP address to use instead of the provisioned one.
#baseIP: 95.165.135.109
nameOverride: gitlab
# `ce` or `ee`
gitlab: ce
gitlabCEImage: gitlab/gitlab-ce:10.6.2-ce.0
gitlabEEImage: gitlab/gitlab-ee:10.6.2-ee.0
postgresPassword: NDl1ZjNtenMxcWR6NXZnbw==
initialSharedRunnersRegistrationToken: "tQtCbx5UZy_ByS7FyzUH"
mattermostAppSecret: NDl1ZjNtenMxcWR6NXZnbw==
mattermostAppUID: aadas
redisImage: redis:3.2.10
redisDedicatedStorage: true
redisStorageSize: 5Gi
redisAccessMode: ReadWriteOnce
postgresImage: postgres:9.6.5
# If you disable postgresDedicatedStorage, you should consider bumping up gitlabRailsStorageSize
postgresDedicatedStorage: true
postgresAccessMode: ReadWriteOnce
postgresStorageSize: 30Gi
gitlabDataAccessMode: ReadWriteOnce
#gitlabDataStorageSize: 30Gi
gitlabRegistryAccessMode: ReadWriteOnce
#gitlabRegistryStorageSize: 30Gi
gitlabConfigAccessMode: ReadWriteOnce
#gitlabConfigStorageSize: 1Gi
gitlabRunnerImage: gitlab/gitlab-runner:alpine-v10.6.0
# Valid values for provider are `gke` for Google Container Engine. Leaving it blank (or any othervalue) will disable fast disk options.
#provider: gke

# Gitlab pages
# The following 3 lines are needed to enable gitlab pages.
# pagesExternalScheme: http
# pagesExternalDomain: your-pages-domain.com
# pagesTlsSecret: gitlab-pages-tls # An optional reference to a tls secret to use in pages

## Storage Class Options
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## If not defined, but provider is gke, will use SSDs
## Otherwise default: volume.alpha.kubernetes.io/storage-class: default
gitlabConfigStorageClass: gluster-heketi
gitlabDataStorageClass: gluster-heketi
gitlabRegistryStorageClass: gluster-heketi
postgresStorageClass: gluster-heketi
redisStorageClass: gluster-heketi

healthCheckToken: 'SXBAQichEJasbtDSygrD'
# Optional, for GitLab EE images only
#gitlabEELicense: base64-encoded-license

# Additional omnibus configuration,
# see https://docs.gitlab.com/omnibus/settings/configuration.html
# for possible configuration options
#omnibusConfigRuby: |
#  gitlab_rails['smtp_enable'] = true
#  gitlab_rails['smtp_address'] = "smtp.example.org"

gitlab-runner:
  checkInterval: 1
  # runnerRegistrationToken must equal initialSharedRunnersRegistrationToken
  runnerRegistrationToken: "tQtCbx5UZy_ByS7FyzUH"
  # resources:
  #   limits:
  #     memory: 500Mi
  #     cpu: 600m
  #   requests:
  #     memory: 500Mi
  #     cpu: 600m
  runners:
    privileged: true
    ## Build Container specific configuration
    ##
    # builds:
    #   cpuLimit: 200m
    #   memoryLimit: 256Mi
    #   cpuRequests: 100m
    #   memoryRequests: 128Mi

    ## Service Container specific configuration
    ##
    # services:
    #   cpuLimit: 200m
    #   memoryLimit: 256Mi
    #   cpuRequests: 100m
    #   memoryRequests: 128Mi

    ## Helper Container specific configuration
    ##
    # helpers:
    #   cpuLimit: 200m
    #   memoryLimit: 256Mi
    #   cpuRequests: 100m
    #   memoryRequests: 128Mi

你可以看到我有StorageClass:

# kubectl get sc
NAME             PROVISIONER               AGE
gluster-heketi   kubernetes.io/glusterfs   48m

1 个答案:

答案 0 :(得分:1)

如果没有您使用的实际头盔的链接,任何人都无法解决为什么go-template没有正确使用您的values.yaml

  

我在PVC说明中看到volume.alpha.kubernetes.io/storage-class: default,但我在values.yaml中设置了值gitlabDataStorageClass: gluster-heketi

我很感激你在values.yaml中设置了你想要的任何内容,但只要StorageClass与现有的StorageClass不匹配,我就不确定那里会有什么积极的东西。您当然可以尝试创建一个名为StorageClass的{​​{1}}包含与default SC相同的值,或者更新PVC以使用正确的SC。

老实说,这可能是掌舵图中的一个错误,但在修复之前(和/或我们获取图表链接以帮助您了解如何调整您的yaml)如果您希望GitLab部署,你需要手动解决这种糟糕的情况。