You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-23Lines changed: 40 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,17 @@
1
1
# Oracle OKE Terraform
2
2
3
-
This repository contains the required Terraform scripts to set up K8s using OKE in the Oracle Free Tier.
3
+
This repository contains the **Terraform** scripts to bootstrap a Kubernetes Cluster in the **Oracle Cloud Infrastructure Free Tier** with **Oracle Kubernetes Engine (OKE)**.
4
+
5
+
Additionally, **ArgoCD** will be installed in the bootstrapped cluster for GitOps management of the cluster resources.
4
6
5
7
## Requirements
6
8
9
+
### Variables
10
+
11
+
This variables don't have default declared values and are required to be provided to the scripts.
12
+
13
+
Create a `.tfvars` file in the root folder of this repository with the following variables declared:
14
+
7
15
| Variable | Definition |
8
16
| -------- | ---------------- |
9
17
|`region`| Value of the region where we want to deploy the cluster |
@@ -12,21 +20,13 @@ This repository contains the required Terraform scripts to set up K8s using OKE
12
20
|`user_rsa_path`| Path where we store the generated RSA key, better to use `~/.oci/oci-rsa.pem`|
13
21
|`user_rsa_fingerprint`| After generating the RSA Keys, we can consult the fingerprint in the Oracle Cloud Console |
14
22
15
-
### OCI CLI
16
-
17
-
We will require from the OCI CLI to access to our created Kubernetes Cluster, so this should be installed.
23
+
Other variables, which are not mandatory, can be provided in this file as well. For a complete description of all the variables, check the contents on the [variables.tf file](variables.tf).
18
24
19
-
Instructions on how to install the OCI CLI for different environments can be found [here](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm).
20
-
21
-
### Kubectl
22
-
23
-
In order to interact with our K8s Cluster using the Kubernetes API, we require the command-line tool for Kubernetes: `kubectl`.
25
+
### Oracle Cloud Infrastructure (OCI) Access
24
26
25
-
How to install it in different environments is available in [here](https://kubernetes.io/docs/tasks/tools/#kubectl)
27
+
In order to be able to perform operations against OCI, we need to create and import an RSA Key for API signing.
26
28
27
-
### RSA Keys
28
-
29
-
In order to be able to run this scripts against OCI (Oracle Cloud Infrastructure), you have to create and import RSA Keys for API signing.
29
+
This can be easily performed with the following steps:
5. Add the public key to your OCI user account from `User Settings > API Keys`
57
57
58
-
6. Modify the file under `$HOME/.oci/config` and add the following keys:
58
+
### Oracle Cloud Infrastructure (OCI) CLI
59
+
60
+
We need a correctly configured OCI CLI to log against our to-be-created Kubernetes Cluster, as we will use the K8s login plugin to get a JWT for access.
61
+
62
+
Instructions on how to install the OCI CLI for different environments can be found [here](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm).
63
+
64
+
Once we have installed the tool, we need to configure it to use the previously generated RSA Key to interact with out OCI Tenancy. In order to do that, we are going to create (or modify if it has been automatically created) the file `$HOME/.oci/config` with the following keys:
59
65
60
66
```text
61
67
tenancy=<tenancy_ocid>
@@ -65,28 +71,39 @@ key_file=<user_rsa_path>
65
71
fingerprint=<user_rsa_fingerprint>
66
72
```
67
73
74
+
How to retrieve these values is explained in the [variables section](#variables).
75
+
76
+
### Kubernetes Command-Line Tool
77
+
78
+
In order to interact with our K8s Cluster using the Kubernetes API, we require a Kubernetes CLI; at this point, it's on your choice whether to use install the official CLI from Kubernetes (`kubectl`) or some other CLI tool as K9s (as I personally use).
79
+
80
+
- How to install `kubectl` in different environments is available in [here](https://kubernetes.io/docs/tasks/tools/#kubectl)
81
+
- How to install `k9s` in different environments is available in [here](https://k9scli.io/topics/install/)
82
+
68
83
## Usage
69
84
70
85
First, override all the variables by using a file in the root directory of our Terraform scripts with the defined variables in the [Requirement](#requirements) section with the name `env.tfvars`.
71
86
72
87
Then, in order to create the cluster, just run the following:
73
88
74
89
```shell
75
-
terraform apply -var-file="env.tfvars"
90
+
$ terraform apply -var-file="env.tfvars"
76
91
```
77
92
78
93
Check that everything is correct, and type `yes` on the required input. In some minutes, the cluster will be ready and a `kubeconfig` will be placed in the folder `generated`.
79
94
80
-
In order to start using this cluster, you can just:
81
-
82
-
- Move the kubeconfig to the default location of `$HOME/.kube/config`
95
+
In order to start using this cluster, you can just export the `KUBECONFIG` environment variable to our current location and use your desired Kubernetes CLI Tool.
83
96
84
97
```shell
85
-
mv /generated/kubeconfig ~/.kube/config
98
+
$ export KUBECONFIG=$(pwd)/generated/kubeconfig
99
+
$ k9s
86
100
```
87
101
88
-
- Export the `KUBECONFIG` environment variable to our current location
0 commit comments