Skip to content

Commit 07cfcc6

Browse files
adityathebemoshloop
authored andcommitted
docs: Installing playbooks using kubeconfig for SAAS
1 parent c82d781 commit 07cfcc6

File tree

9 files changed

+186
-114
lines changed

9 files changed

+186
-114
lines changed

mission-control/docs/installation/saas/kubectl.md

-107
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
title: Kubectl Access
3+
---
4+
5+
Mission Control SaaS instances are deployed on dedicated [vCluster](https://www.vcluster.com/) instances.
6+
7+
Mission Control configuration is managed through Kubernetes Custom Resource Definitions (CRDs). Depending on your deployment model, you may need to apply resources directly to the vCluster. To facilitate this, you can download a `kubeconfig` file after authentication.
8+
9+
<Screenshot img="/img/download-kubeconfig.png" size="400px"/>
10+
11+
The access token provided has role-based permissions limited to either [mission-control-reader](https://github.com/flanksource/mission-control-chart/blob/main/chart/templates/rbac.yaml#L130-L143) or [mission-control-writer](https://github.com/flanksource/mission-control-chart/blob/main/chart/templates/rbac.yaml#L145C1-L169C17), based on your selected role. Use this `kubeconfig` file to interact with your Mission Control SaaS instance via `kubectl`.
12+
13+
:::tip Production
14+
For production environments, it is recommended to use GitOps tools like Argo CD or Flux to manage configurations rather than applying them directly with kubectl. Use the kubeconfig file to configure your GitOps tool to target the Mission Control SaaS instance.
15+
:::
16+
17+
1. Save the kubeconfig to your GitOps cluster:
18+
19+
```shell
20+
kubectl create secret generic mission-control-kubeconfig \
21+
-n flux-system \
22+
--from-file=KUBECONFIG=./kubeconfig
23+
```
24+
<br></br>
25+
26+
2. Reference the kubeconfig when deploying Mission Control manifests:
27+
28+
```yaml
29+
apiVersion: kustomize.toolkit.fluxcd.io/v1
30+
kind: Kustomization
31+
metadata:
32+
name: mission-control-config
33+
namespace: flux-system
34+
spec:
35+
interval: 10m
36+
path: ./
37+
prune: true
38+
sourceRef:
39+
kind: GitRepository
40+
name: mission-control-gitops
41+
kubeConfig:
42+
secretRef:
43+
name: mission-control-kubeconfig
44+
key: KUBECONFIG
45+
```
46+
47+
## Example: Installing Playbooks
48+
49+
Let's walk through an example of installing playbooks using the `mission-control-playbooks-kubernetes` Helm chart.
50+
The chart installs a list of playbooks that you can use to manage Kubernetes resources. You can tweak the `values.yaml` file to install only the playbooks you want.
51+
For this example, we'll use the default values, which installs most of the playbooks.
52+
53+
<Tabs>
54+
<TabItem value="kubectl" label="Kubectl">
55+
1. First, ensure you have the `kubeconfig.yaml` file downloaded and saved as described above.
56+
57+
2. Add the Flanksource Helm repository:
58+
59+
```shell
60+
helm repo add flanksource https://flanksource.github.io/charts
61+
helm repo update flanksource
62+
```
63+
<br></br>
64+
65+
3. Install the `mission-control-playbooks-kubernetes` chart:
66+
67+
```shell
68+
helm install mission-control-playbooks-kubernetes flanksource/mission-control-playbooks-kubernetes --kubeconfig=./kubeconfig.yaml
69+
```
70+
<br></br>
71+
</TabItem>
72+
73+
<TabItem value="flux" label="GitOps with Flux">
74+
75+
Assuming you have flux setup in your cluster, you can use the following manifests to install the playbooks in the SAAS instance.
76+
77+
1. First, ensure you have the `kubeconfig.yaml` file downloaded and saved as described above.
78+
79+
2. Create a namespace that'll hold the Mission Control resources:
80+
81+
```yaml title="specs/namespace.yaml"
82+
apiVersion: v1
83+
kind: Namespace
84+
metadata:
85+
name: missioncontrol
86+
```
87+
<br></br>
88+
89+
3. Save the kubeconfig to your GitOps cluster:
90+
91+
```yaml title="specs/kubeconfig.yaml"
92+
apiVersion: v1
93+
kind: Secret
94+
metadata:
95+
name: mission-control-kubeconfig
96+
namespace: missioncontrol
97+
type: Opaque
98+
stringData:
99+
kubeconfig: |-
100+
<your kubeconfig here>
101+
```
102+
<br></br>
103+
104+
:::note Encrypt
105+
It's recommended that you encrypt the kubeconfig file before saving it to the cluster.
106+
E.g. using [sops](https://github.com/getsops/sops)
107+
:::
108+
109+
4. Install the flanksource helm repository
110+
111+
```yaml title="specs/helmrepo.yaml"
112+
apiVersion: source.toolkit.fluxcd.io/v1beta2
113+
kind: HelmRepository
114+
metadata:
115+
name: flanksource
116+
namespace: missioncontrol
117+
spec:
118+
interval: 10m
119+
url: https://flanksource.github.io/charts
120+
```
121+
<br></br>
122+
123+
5. Reference the kubeconfig when deploying Mission Control manifests:
124+
125+
```yaml title="specs/helmrelease.yaml"
126+
apiVersion: helm.toolkit.fluxcd.io/v2beta1
127+
kind: HelmRelease
128+
metadata:
129+
name: mission-control-playbooks-kubernetes
130+
namespace: missioncontrol
131+
spec:
132+
releaseName: mission-control-playbooks-kubernetes
133+
interval: 5m
134+
chart:
135+
spec:
136+
chart: mission-control-playbooks-kubernetes
137+
sourceRef:
138+
kind: HelmRepository
139+
name: flanksource
140+
kubeConfig:
141+
secretRef:
142+
name: mission-control-kubeconfig
143+
key: kubeconfig
144+
```
145+
<br></br>
146+
147+
6. A kustomization
148+
149+
```yaml title="specs/kustomization.yaml"
150+
apiVersion: kustomize.config.k8s.io/v1beta1
151+
kind: Kustomization
152+
resources:
153+
- namespace.yaml
154+
- helmrepo.yaml
155+
- helmrelease.yaml
156+
- kubeconfig.yaml
157+
```
158+
<br></br>
159+
160+
7. Finally, create a flux Kustomization to apply the manifests:
161+
162+
```yaml title="kustomization.yaml"
163+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
164+
kind: Kustomization
165+
metadata:
166+
name: mission-control-playbooks
167+
namespace: flux-system
168+
spec:
169+
interval: 5m
170+
path: ./specs
171+
prune: true
172+
sourceRef:
173+
kind: GitRepository
174+
name: <your-git-repo-name>
175+
```
176+
<br></br>
177+
178+
</TabItem>
179+
</Tabs>

0 commit comments

Comments
 (0)