GitLab Helm ChartをGoogle GKEにインストールする

Google Cloud Platform Marketplace（Beta版）が公開されて最初からGitLab Helm Chartが3クリックインストールできるようになりました。

https://about.gitlab.com/2018/07/18/install-gitlab-one-click-gcp-marketplace/

かなり楽ですが、今回手動で挑戦してみたいと思います。

![tanukiinsnow.jpg.838x0_q80.jpg](https://qiita-image-store.s3.amazonaws.com/0/260796/57d38fcb-06a7-a5fe-440a-fb417585b5b1.jpeg)

# 事前準備

* Google Cloud PlatformでProjectを作成
* ProjectにKubernetes APIを有効化
* [gcloud](https://cloud.google.com/sdk/docs/quickstart-mac-os-x)
* `gcloud auth login`で認証
* Chartのレポジトリをclone
* Mac OSの場合、スクリプトの[微修正](https://gitlab.com/charts/gitlab/issues/369)が必要

# GKEクラスタの構築

GitLabが一番力を入れているクラウドサービスプロバイダーだけがあって、[クラスタの構築ツール](https://gitlab.com/charts/gitlab/blob/master/doc/cloud/gke.md)を公開してくれています。

今回あえてスクリプトを使わずに手動で行います。

```shell-session
> gcloud auth login

> gcloud config set project bakeneco-211008
Updated property [core/project].

> gcloud beta container clusters create "bakeneco" --username "admin" --cluster-version "1.9.7-gke.3" --machine-type "n1-standard-2" --image-type "COS" --disk-type "pd-standard" --disk-size "100" --scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "3" --enable-cloud-logging --enable-cloud-monitoring --network "default" --subnetwork "default" --addons HorizontalPodAutoscaling,HttpLoadBalancing,KubernetesDashboard --no-enable-autoupgrade --enable-autorepair
WARNING: Currently VPC-native is not the default mode during cluster creation. In the future, this will become the default mode and can be disabled using `--no-enable-ip-alias` flag. Use `--[no-]enable-ip-alias` flag to suppress this warning.
This will enable the autorepair feature for nodes. Please see
https://cloud.google.com/kubernetes-engine/docs/node-auto-repair for more
information on node autorepairs.

This will disable the autoupgrade feature for nodes. Please see
https://cloud.google.com/kubernetes-engine/docs/node-management for more
information on node autoupgrades.

Creating cluster bakeneco...done.                                                                                                               
Created [https://container.googleapis.com/v1beta1/projects/bakeneco-211008/zones/asia-northeast1-a/clusters/bakeneco].
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/asia-northeast1-a/bakeneco?project=bakeneco-211008
kubeconfig entry generated for bakeneco.
NAME      LOCATION           MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS
bakeneco  asia-northeast1-a  1.9.7-gke.3     35.200.103.180  n1-standard-2  1.9.7-gke.3   3          RUNNING

> gcloud config unset container/use_client_certificate
Unset property [container/use_client_certificate].

> > gcloud container clusters get-credentials bakeneco
Fetching cluster endpoint and auth data.
kubeconfig entry generated for bakeneco.
```

> Unknown user "client" を食らっていたので[回避策](https://stackoverflow.com/questions/49075723/what-does-unknown-user-client-mean)を利用します。

```shell-session
> kubectl get nodes
NAME                                      STATUS    ROLES     AGE       VERSION
gke-bakeneco-default-pool-64aa7c15-glqp   Ready     <none>    3m        v1.9.7-gke.3
gke-bakeneco-default-pool-64aa7c15-jrg7   Ready     <none>    3m        v1.9.7-gke.3
gke-bakeneco-default-pool-64aa7c15-qbkl   Ready     <none>    3m        v1.9.7-gke.3

> kubectl get services --all-namespaces
NAMESPACE     NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
default       kubernetes             ClusterIP   10.31.240.1     <none>        443/TCP         4m
kube-system   default-http-backend   NodePort    10.31.251.219   <none>        80:31148/TCP    4m
kube-system   heapster               ClusterIP   10.31.250.35    <none>        80/TCP          4m
kube-system   kube-dns               ClusterIP   10.31.240.10    <none>        53/UDP,53/TCP   4m
kube-system   kubernetes-dashboard   ClusterIP   10.31.253.218   <none>        443/TCP         4m
kube-system   metrics-server         ClusterIP   10.31.242.139   <none>        443/TCP         4m

> kubectl get deployments --all-namespaces
NAMESPACE     NAME                    DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
kube-system   event-exporter-v0.1.9   1         1         1            1           4m
kube-system   heapster-v1.5.2         1         1         1            1           4m
kube-system   kube-dns                2         2         2            2           4m
kube-system   kube-dns-autoscaler     1         1         1            1           4m
kube-system   kubernetes-dashboard    1         1         1            1           4m
kube-system   l7-default-backend      1         1         1            1           4m
kube-system   metrics-server-v0.2.1   1         1         1            1           4m

> > kubectl get pods --all-namespaces
NAMESPACE     NAME                                                 READY     STATUS    RESTARTS   AGE
kube-system   event-exporter-v0.1.9-5c8fb98cdb-dhl4t               2/2       Running   0          4m
kube-system   fluentd-gcp-v2.0.17-gxtmz                            2/2       Running   0          4m
kube-system   fluentd-gcp-v2.0.17-prg4n                            2/2       Running   0          4m
kube-system   fluentd-gcp-v2.0.17-x2fxq                            2/2       Running   0          4m
kube-system   heapster-v1.5.2-6bf8ff669-qkwbj                      3/3       Running   0          3m
kube-system   kube-dns-5dcfcbf5fb-5hvnl                            4/4       Running   0          4m
kube-system   kube-dns-5dcfcbf5fb-hqskb                            4/4       Running   0          3m
kube-system   kube-dns-autoscaler-69c5cbdcdd-8vzwk                 1/1       Running   0          4m
kube-system   kube-proxy-gke-bakeneco-default-pool-64aa7c15-glqp   1/1       Running   0          4m
kube-system   kube-proxy-gke-bakeneco-default-pool-64aa7c15-jrg7   1/1       Running   0          4m
kube-system   kube-proxy-gke-bakeneco-default-pool-64aa7c15-qbkl   1/1       Running   0          4m
kube-system   kubernetes-dashboard-6d6c7fb64c-wphpx                1/1       Running   0          4m
kube-system   l7-default-backend-57856c5f55-n8nqp                  1/1       Running   0          4m
kube-system   metrics-server-v0.2.1-7f8dd98c8f-pq7pt               2/2       Running   0          3m
```

# クラスタ環境の設定

### [ネットワーク設定](https://docs.gitlab.com/ee/install/kubernetes/preparation/networking.html)

External IPを事前に確保します。同じRegionを指定する必要があります。

```shell-session
> gcloud beta compute addresses create bakeneco-ip --network-tier=PREMIUM
For the following address:
 - [bakeneco-ip]
choose a region or global:
 [1] global
 [2] region: asia-east1
 [3] region: asia-northeast1
 [4] region: asia-south1
 [5] region: asia-southeast1
 [6] region: australia-southeast1
 [7] region: europe-north1
 [8] region: europe-west1
 [9] region: europe-west2
 [10] region: europe-west3
 [11] region: europe-west4
 [12] region: northamerica-northeast1
 [13] region: southamerica-east1
 [14] region: us-central1
 [15] region: us-east1
 [16] region: us-east4
 [17] region: us-west1
 [18] region: us-west2
Please enter your numeric choice:  14

Created [https://www.googleapis.com/compute/beta/projects/bakeneco-211008/regions/us-central1/addresses/bakeneco-ip].
```

この時点でDNSレコードを登録しておきます。

### [ストレージ設定](https://gitlab.com/charts/gitlab/blob/master/doc/installation/storage.md)

`reclaimPolicy: Retain`のStorageClassが欲しいので新たに作成し、既存のものからdefault設定を外します。

```yaml:gke-storage-class.yaml 
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: pd-gitlab
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Retain
parameters:
  type: pd-standard
```



```shell-session
> kubectl create -f gke-storage-class.yaml 
storageclass.storage.k8s.io "pd-gitlab" created

> kubectl get sc
NAME                 PROVISIONER            AGE
pd-gitlab            kubernetes.io/gce-pd   1m
standard (default)   kubernetes.io/gce-pd   19m

> kubectl describe sc
Name:                  pd-gitlab
IsDefaultClass:        No
Annotations:           <none>
Provisioner:           kubernetes.io/gce-pd
Parameters:            type=pd-standard
AllowVolumeExpansion:  <unset>
MountOptions:          <none>
ReclaimPolicy:         Retain
VolumeBindingMode:     Immediate
Events:                <none>


Name:                  standard
IsDefaultClass:        Yes
Annotations:           storageclass.beta.kubernetes.io/is-default-class=true
Provisioner:           kubernetes.io/gce-pd
Parameters:            type=pd-standard
AllowVolumeExpansion:  <unset>
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>


> kubectl patch storageclass pd-gitlab -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
storageclass.storage.k8s.io "pd-gitlab" patched


> kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.beta.kubernetes.io/is-default-class":"false"}}}'
storageclass.storage.k8s.io "standard" patched

> kubectl describe sc
Name:                  pd-gitlab
IsDefaultClass:        Yes
Annotations:           storageclass.kubernetes.io/is-default-class=true
Provisioner:           kubernetes.io/gce-pd
Parameters:            type=pd-standard
AllowVolumeExpansion:  <unset>
MountOptions:          <none>
ReclaimPolicy:         Retain
VolumeBindingMode:     Immediate
Events:                <none>


Name:                  standard
IsDefaultClass:        No
Annotations:           storageclass.beta.kubernetes.io/is-default-class=false
Provisioner:           kubernetes.io/gce-pd
Parameters:            type=pd-standard
AllowVolumeExpansion:  <unset>
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>

> kubectl get sc
NAME                  PROVISIONER            AGE
pd-gitlab (default)   kubernetes.io/gce-pd   3m
standard              kubernetes.io/gce-pd   21m
```

### [Tiller](https://docs.gitlab.com/ee/install/kubernetes/preparation/tiller.html)

```shell-session
> gcloud container clusters describe bakeneco --format='value(masterAuth.password)'
nya!!

> kubectl --username=admin --password=nya!! create -f rbac-config.yaml
serviceaccount "tiller" created
clusterrolebinding.rbac.authorization.k8s.io "tiller" created

> helm init --service-account tiller
$HELM_HOME has been configured at /Users/jb/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
```

# GitLab Chartのインストール

GitLab chart repositoryを追加します。

```shell-session
> helm repo add gitlab https://charts.gitlab.io/
"gitlab" has been added to your repositories
```

HelmでGitLab Chartをインストールします（`--set global.hosts.externalIP`を忘れずに！）。


```shell-session
> helm upgrade --install gitlab gitlab/gitlab \
                                                                      --timeout 600 \
                                                                      --set global.hosts.domain=bakeneco.io \
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　--set global.hosts.externalIP=35.208.219.148 \
                                                                      --set gitlab.gitaly.persistence.storageClass=pd-gitlab \
                                                                      --set postgresql.persistence.storageClass=pd-gitlab \
                                                                      --set gitlab.redis.persistence.storageClass=pd-gitlab \
                                                                      --set gitlab.minio.persistence.storageClass=pd-gitlab \
                                                                      --set certmanager-issuer.email=jvasseur@gmail.com
Release "gitlab" does not exist. Installing it now.
NAME:   gitlab
LAST DEPLOYED: Thu Aug  2 17:42:48 2018
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ServiceAccount
NAME                                  SECRETS  AGE
gitlab-certmanager-issuer             1        3s
certmanager-gitlab                    1        3s
gitlab-gitlab-runner                  1        3s
gitlab-nginx-ingress                  1        3s
gitlab-prometheus-alertmanager        1        3s
gitlab-prometheus-kube-state-metrics  1        3s
gitlab-prometheus-node-exporter       1        3s
gitlab-prometheus-server              1        3s

==> v1beta1/ClusterRoleBinding
NAME                                  AGE
certmanager-gitlab                    3s
gitlab-prometheus-alertmanager        3s
gitlab-prometheus-kube-state-metrics  3s
gitlab-prometheus-node-exporter       3s
gitlab-prometheus-server              3s

==> v1/RoleBinding
NAME                       AGE
gitlab-certmanager-issuer  3s
gitlab-nginx-ingress       3s

==> v1beta2/Deployment
NAME                                  DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
gitlab-gitlab-shell                   1        1        1           0          3s
gitlab-sidekiq-all-in-1               1        1        1           0          3s
gitlab-task-runner                    1        1        1           0          2s
gitlab-unicorn                        1        1        1           0          2s
gitlab-minio                          1        1        1           0          2s
gitlab-nginx-ingress-controller       3        3        3           0          2s
gitlab-nginx-ingress-default-backend  2        2        2           0          2s
gitlab-redis                          1        1        1           0          2s
gitlab-registry                       1        0        0           0          2s

==> v1/Service
NAME                                  TYPE          CLUSTER-IP     EXTERNAL-IP  PORT(S)                                  AGE
gitlab-gitaly                         ClusterIP     None           <none>       8075/TCP,9236/TCP                        3s
gitlab-gitlab-shell                   ClusterIP     10.31.250.214  <none>       22/TCP                                   3s
gitlab-unicorn                        ClusterIP     10.31.247.124  <none>       8080/TCP,8181/TCP                        3s
gitlab-minio-svc                      ClusterIP     10.31.247.191  <none>       9000/TCP                                 3s
gitlab-nginx-ingress-controller       LoadBalancer  10.31.250.114  <pending>    80:32488/TCP,443:31850/TCP,22:31480/TCP  3s
gitlab-nginx-ingress-default-backend  ClusterIP     10.31.243.127  <none>       80/TCP                                   3s
gitlab-postgresql                     ClusterIP     10.31.248.162  <none>       5432/TCP                                 3s
gitlab-prometheus-server              ClusterIP     10.31.248.134  <none>       80/TCP                                   3s
gitlab-redis                          ClusterIP     10.31.241.235  <none>       6379/TCP,9121/TCP                        3s
gitlab-registry                       ClusterIP     10.31.249.187  <none>       5000/TCP                                 3s

==> v1beta2/StatefulSet
NAME           DESIRED  CURRENT  AGE
gitlab-gitaly  1        1        2s

==> v1/Job
NAME                           DESIRED  SUCCESSFUL  AGE
gitlab-issuer.1                1        0           2s
gitlab-migrations.1            1        0           2s
gitlab-minio-create-buckets.1  1        0           2s

==> v1beta1/Ingress
NAME             HOSTS                 ADDRESS  PORTS  AGE
gitlab-unicorn   gitlab.bakeneco.io    80, 443  2s
gitlab-minio     minio.bakeneco.io     80, 443  2s
gitlab-registry  registry.bakeneco.io  80, 443  2s

==> v2beta1/HorizontalPodAutoscaler
NAME                     REFERENCE                           TARGETS        MINPODS  MAXPODS  REPLICAS  AGE
gitlab-gitlab-shell      Deployment/gitlab-gitlab-shell      <unknown>/75%  2        10       0         2s
gitlab-sidekiq-all-in-1  Deployment/gitlab-sidekiq-all-in-1  <unknown>/75%  1        10       0         1s
gitlab-unicorn           Deployment/gitlab-unicorn           <unknown>/75%  2        10       0         1s
gitlab-registry          Deployment/gitlab-registry          <unknown>/75%  2        10       0         1s

==> v1/ConfigMap
NAME                                   DATA  AGE
gitlab-certmanager-issuer-certmanager  2     3s
gitlab-gitlab-runner                   3     3s
gitlab-gitaly                          3     3s
gitlab-gitlab-shell                    2     3s
gitlab-nginx-ingress-tcp               1     3s
gitlab-migrations                      4     3s
gitlab-sidekiq-all-in-1                1     3s
gitlab-sidekiq                         5     3s
gitlab-task-runner                     4     3s
gitlab-unicorn                         8     3s
gitlab-unicorn-tests                   1     3s
gitlab-minio-config-cm                 3     3s
gitlab-nginx-ingress-controller        7     3s
gitlab-postgresql                      0     3s
gitlab-prometheus-server               3     3s
gitlab-redis                           2     3s
gitlab-registry                        2     3s

==> v1beta1/CustomResourceDefinition
NAME                               AGE
certificates.certmanager.k8s.io    3s
clusterissuers.certmanager.k8s.io  3s
issuers.certmanager.k8s.io         3s

==> v1/Role
gitlab-certmanager-issuer  3s
gitlab-nginx-ingress       3s

==> v1beta1/Deployment
NAME                      DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
certmanager-gitlab        1        1        1           0          3s
gitlab-gitlab-runner      1        1        1           0          3s
gitlab-postgresql         1        1        1           0          2s
gitlab-prometheus-server  1        1        1           0          2s

==> v1beta1/PodDisruptionBudget
NAME                                  MIN AVAILABLE  MAX UNAVAILABLE  ALLOWED DISRUPTIONS  AGE
gitlab-gitaly                         N/A            1                0                    1s
gitlab-gitlab-shell                   N/A            1                0                    1s
gitlab-sidekiq                        N/A            1                0                    1s
gitlab-unicorn                        N/A            1                0                    1s
gitlab-minio-v1                       N/A            1                0                    1s
gitlab-nginx-ingress-controller       2              N/A              0                    1s
gitlab-nginx-ingress-default-backend  1              N/A              0                    1s
gitlab-redis-v1                       N/A            1                0                    1s
gitlab-registry-v1                    N/A            1                0                    1s

==> v1/PersistentVolumeClaim
NAME                      STATUS   VOLUME     CAPACITY  ACCESS MODES  STORAGECLASS  AGE
gitlab-minio              Pending  pd-gitlab  3s
gitlab-postgresql         Pending  pd-gitlab  3s
gitlab-prometheus-server  Pending  pd-gitlab  3s
gitlab-redis              Pending  pd-gitlab  3s

==> v1beta1/ClusterRole
NAME                                  AGE
certmanager-gitlab                    3s
gitlab-prometheus-kube-state-metrics  3s
gitlab-prometheus-server              3s

==> v1beta1/Role
gitlab-gitlab-runner  3s

==> v1beta1/RoleBinding
NAME                  AGE
gitlab-gitlab-runner  3s

==> v1/Pod(related)
NAME                                                  READY  STATUS             RESTARTS  AGE
certmanager-gitlab-56f5486fdb-tqswn                   0/2    ContainerCreating  0         3s
gitlab-gitlab-runner-84dff6795b-fpc9m                 0/1    Init:0/1           0         3s
gitlab-gitlab-shell-55b6bd5758-jxvd8                  0/1    Init:0/1           0         2s
gitlab-sidekiq-all-in-1-65bfc6d6d7-7cnnm              0/1    Init:0/2           0         2s
gitlab-task-runner-7b67867f4f-v4cq2                   0/1    Init:0/1           0         2s
gitlab-unicorn-859bc7c5f8-wl9ng                       0/1    Init:0/2           0         2s
gitlab-minio-567c4bd69d-pw8bz                         0/1    Pending            0         2s
gitlab-nginx-ingress-controller-754587444-lb5zd       0/1    Pending            0         2s
gitlab-nginx-ingress-controller-754587444-qxk94       0/1    Pending            0         2s
gitlab-nginx-ingress-controller-754587444-smsqq       0/1    ContainerCreating  0         2s
gitlab-nginx-ingress-default-backend-c955db9c6-5nxv8  0/1    ContainerCreating  0         2s
gitlab-nginx-ingress-default-backend-c955db9c6-r2fn6  0/1    Pending            0         1s
gitlab-postgresql-57c66b8d6b-nhtkq                    0/2    Pending            0         1s
gitlab-prometheus-server-8cf4fdd8-8v9d6               0/2    Pending            0         1s
gitlab-redis-75764d5485-fc6cg                         0/2    Pending            0         1s
gitlab-registry-7d49c84859-vt7xf                      0/1    Pending            0         1s
gitlab-gitaly-0                                       0/1    Pending            0         2s
gitlab-issuer.1-p9szp                                 0/1    ContainerCreating  0         2s
gitlab-migrations.1-c7pbq                             0/1    Init:0/1           0         2s
gitlab-minio-create-buckets.1-7bv8m                   0/1    ContainerCreating  0         2s
```

```shell_session
> kubectl describe service gitlab-nginx-ingress-controller | grep Ingress
LoadBalancer Ingress:     35.224.231.89

> kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode
nyan!
```

暫く待つとすべてのPodが立ち上がります。

```shell-session
> > kubectl get pods 
NAME                                                   READY     STATUS      RESTARTS   AGE
certmanager-gitlab-56f5486fdb-tqswn                    2/2       Running     0          16m
gitlab-gitaly-0                                        1/1       Running     0          16m
gitlab-gitlab-runner-84dff6795b-fpc9m                  1/1       Running     8          16m
gitlab-gitlab-shell-55b6bd5758-959xw                   1/1       Running     0          16m
gitlab-gitlab-shell-55b6bd5758-jxvd8                   1/1       Running     0          16m
gitlab-issuer.1-p9szp                                  0/1       Completed   0          16m
gitlab-migrations.1-c7pbq                              0/1       Completed   0          16m
gitlab-minio-567c4bd69d-pw8bz                          1/1       Running     0          16m
gitlab-minio-create-buckets.1-7bv8m                    0/1       Completed   0          16m
gitlab-nginx-ingress-controller-754587444-lb5zd        1/1       Running     3          16m
gitlab-nginx-ingress-controller-754587444-qxk94        1/1       Running     3          16m
gitlab-nginx-ingress-controller-754587444-smsqq        1/1       Running     3          16m
gitlab-nginx-ingress-default-backend-c955db9c6-5nxv8   1/1       Running     0          16m
gitlab-nginx-ingress-default-backend-c955db9c6-r2fn6   1/1       Running     0          16m
gitlab-postgresql-57c66b8d6b-nhtkq                     2/2       Running     0          16m
gitlab-prometheus-server-8cf4fdd8-8v9d6                2/2       Running     0          16m
gitlab-redis-75764d5485-fc6cg                          2/2       Running     0          16m
gitlab-registry-7d49c84859-czw7k                       1/1       Running     0          16m
gitlab-registry-7d49c84859-vt7xf                       1/1       Running     0          16m
gitlab-sidekiq-all-in-1-65bfc6d6d7-7cnnm               1/1       Running     0          16m
gitlab-task-runner-7b67867f4f-v4cq2                    1/1       Running     0          16m
gitlab-unicorn-859bc7c5f8-2wxgl                        1/1       Running     0          2m
gitlab-unicorn-859bc7c5f8-5ns7j                        1/1       Running     0          2m
gitlab-unicorn-859bc7c5f8-lsf76                        1/1       Running     0          16m
gitlab-unicorn-859bc7c5f8-wl9ng                        1/1       Running     0          16m
```

これでログインできます！

<img width="1445" alt="Screen Shot 2018-08-02 at 18.07.08.png" src="https://qiita-image-store.s3.amazonaws.com/0/260796/46e659f9-1ef1-900a-eced-e285f3984cfe.png">


---

# 手順まとめ

```shell
gcloud auth login

gcloud config set project bakeneco-211008

gcloud beta container clusters create "bakeneco" --username "admin" --cluster-version "1.9.7-gke.3" --machine-type "n1-standard-2" --image-type "COS" --disk-type "pd-standard" --disk-size "100" --scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "3" --enable-cloud-logging --enable-cloud-monitoring --network "default" --subnetwork "default" --addons HorizontalPodAutoscaling,HttpLoadBalancing,KubernetesDashboard --no-enable-autoupgrade --enable-autorepair

gcloud config unset container/use_client_certificate

gcloud container clusters get-credentials bakeneco

kubectl get nodes

kubectl get services --all-namespaces

kubectl get deployments --all-namespaces

kubectl get pods --all-namespaces

kubectl create -f gke-storage-class.yaml

kubectl patch storageclass pd-gitlab -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.beta.kubernetes.io/is-default-class":"false"}}}'

kubectl get sc

gcloud container clusters describe bakeneco --format='value(masterAuth.password)'

kubectl --username=admin --password=nyan create -f rbac-config.yaml

helm init --service-account tiller

helm repo add gitlab https://charts.gitlab.io/

helm upgrade --install gitlab gitlab/gitlab \
                                                                      --timeout 600 \
                                                                      --set global.hosts.domain=bakeneco.io \
                                                                      --set global.hosts.externalIP=35.208.219.148 \
                                                                      --set gitlab.gitaly.persistence.storageClass=pd-gitlab \
                                                                      --set postgresql.persistence.storageClass=pd-gitlab \
                                                                      --set gitlab.redis.persistence.storageClass=pd-gitlab \
                                                                      --set gitlab.minio.persistence.storageClass=pd-gitlab \
                                                                      --set certmanager-issuer.email=jvasseur@gmail.com
```

---

# 追記 2018/8/2

前回試したときにいつもInvalid CertificateでRunnerが立ち上がらず、ログイン画面に遷移できない問題がありましたがなぜか解消しました。
・・・なぜかは調べ中・・・

<img width="1454" alt="Screen Shot 2018-07-23 at 11.43.51.png" src="https://qiita-image-store.s3.amazonaws.com/0/260796/f9779380-2ad4-7e03-4d28-f2a73f02e83e.png">

ちなみに以前、GCP Marketplaceのインストールでも同じ現象が起きてました。

[Issue](https://gitlab.com/charts/deploy-image-helm-base/issues/2)を挙げて反応を見ることにしています。