# Deploying GitLab in multiple clusters

## Deploying GitLab with Istio service mesh

1. `helm` install

```bash
helm -n gitlab template gitlab gitlab/gitlab -f values.yml --version 6.4.1 > gitlab-6.4.1.yml

helm install gitlab gitlab/gitlab -f values.yml --version 6.4.1 -n gitlab
helm upgrade --install gitlab gitlab/gitlab -f values.yml --version 6.4.1 -n gitlab
```

Make sure you can login into GitLab

1. Credentials

```bash
user: root
password: kubectl get secret -n gitlab gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode ; echo
```

1. Get self-signed CA

```bash
kubectl -n gitlab get secret gitlab-wildcard-tls-ca -ojsonpath='{.data.cfssl_ca}'
```

## Deploying Gateway "ingress"

1. Configure the `gateway`

```yaml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gitlab-gateway
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "gitlab.elitebook.tokyo.lab"
```

```bash
kubectl apply -f gitlab-gateway.yml -n gitlab
```

1. Configure the `gateway routes`

```yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: gitlab
spec:
  hosts:
  - "gitlab.elitebook.tokyo.lab"
  gateways:
  - gitlab-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        port:
          number: 8181
        host: gitlab-webservice-default
```

```bash
kubectl apply -f gitlab-gateway-routes.yml -n gitlab
```

## Configure `istio` sidecars

1. `helm templates`

```bash
helm -n gitlab template gitlab gitlab/gitlab -f values.yml --version 6.4.1 > gitlab-6.4.1.yml
```

1. get `mesh-config` values

```bash
kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.config}' > inject-config.yaml
kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.values}' > inject-values.yaml
kubectl -n istio-system get configmap istio -o=jsonpath='{.data.mesh}' > mesh-config.yaml
```

1. inject `istio` side cars

```bash
istioctl kube-inject \
    --injectConfigFile inject-config.yaml \
    --meshConfigFile mesh-config.yaml \
    --valuesFile inject-values.yaml \
    --filename gitlab-6.4.1.yml \
    | kubectl -n gitlab apply -f -
```

## Prometheus

## Grafana

* <https://gitlab.com/gitlab-org/grafana-dashboards/tree/master/omnibus>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://memogarcia.gitbook.io/continuous-learning/tech/automation/gitlab/gitlab-istio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
