How to create a Git Repositories
Objectives
Explain how to create a git repositories in kunai
Prerequisites
- A Sylva management cluster with a provider for the desired environment.
Steps
-
Create an empty git repository on Gitlab
-
In GitLab, navigate to the project group where you want to create the repository and Click "New project/repository".
-
Choose "Create blank project"
-
Enter a project name and optional description. Ensure the visibility level is appropriate for your needs (e.g., private, internal, public).
5. Click "Create project".
-
-
Create access token
We need to provide an acecss token to kunai with role "maintainer" and scope "api, read_repository, write_repository".
-
In GitLab, go to your project settings (bottom left panel: "Settings").
-
Click on "Add new Token"
-
Enter a token name,set the expiration date, set role
Maintainer
and select theapi
,read_repository
, andwrite_repository
scopes. -
Click "Create project access token".
- Copy the generated token immediately. You won't be able to see it again.
-
-
Retrieve a kubeconfig
This example uses Rancher to retrieve the kubeconfig. Adapt these steps if you are using a different method.
- Access your Rancher instance (e.g., https://rancher.sylva/).
-
Select the local cluster.
-
Click "Download Kubeconfig File".
-
Note the
server URL
and thetoken
from the downloaded kubeconfig file. You will need these for configuring Kunai. You can use the following command to extract the token:Info
If you are targeting a different management cluster than the one where kunai is deployed to, please decode the certificate-authority-data and provide it to kunai as cluster certificate
echo "<certificate>"| base64 -d
-
Create a Kunai gitRepository
- Access your Kunai instance (e.g., https://kunai.sylva/).
-
Click "New" on the home page.
-
Enter the project name and other relevant details.
Info
Please update the Git Certificate if your git repositories is using self signed certificate.
Please update the Cluster Certificate if you are targeting a differente management cluster or using the service account.