GithubHelp home page GithubHelp logo

r0b2g1t / k3s-cluster-on-oracle-cloud-infrastructure Goto Github PK

View Code? Open in Web Editor NEW
93.0 93.0 37.0 131 KB

A fully automated Kubernetes k3s cluster deployment including IaC on the Oracle Cloud Infrastructure, which is always free.

License: MIT License

HCL 90.17% Shell 9.83%
automation containers k3s kubernetes kubernetes-cluster oracle-cloud terraform

k3s-cluster-on-oracle-cloud-infrastructure's Introduction

Hi there ๐Ÿ‘‹

r0b2g1t

Anurag's github stats Top Langs

k3s-cluster-on-oracle-cloud-infrastructure's People

Contributors

howstricks avatar ngeorger avatar r0b2g1t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

k3s-cluster-on-oracle-cloud-infrastructure's Issues

Error: shape VM.Standard.E2.1.Micro not found

I am getting the following error after updating the ubuntu image to the one for the region -> eu-frankfurt-1

module.compute.oci_core_instance.worker[1]: Creating...
module.compute.oci_core_instance.worker[0]: Creating...
โ•ท
โ”‚ Error: 404-NotAuthorizedOrNotFound 
โ”‚ Provider version: 4.69.0, released on 2022-03-23.  
โ”‚ Service: Core Instance 
โ”‚ Error Message: shape VM.Standard.E2.1.Micro not found 
โ”‚ OPC request ID: f0e16950924de78391d594d1481FF2194F/DF250747F204905D2CE7474649978B15 
โ”‚ Suggestion: Either the resource has been deleted or service Core Instance need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
โ”‚ 
โ”‚ 
โ”‚   with module.compute.oci_core_instance.worker[0],
โ”‚   on compute/main.tf line 68, in resource "oci_core_instance" "worker":
โ”‚   68: resource "oci_core_instance" "worker" {
โ”‚ 
โ•ต

This is the worker node config I have;

  worker_instance_config = {
    shape_id = "VM.Standard.E2.1.Micro"
    ocpus    = 1
    ram      = 1
    // Canonical-Ubuntu-20.04-2022.03.02-0
    source_id   = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaavcrpbwmm75t6azhxgepxah6vigiwwvruti3gj2frhuxnvhzn3e5a"
    source_type = "image"
    worker_ip_0 = "10.0.0.21"
    worker_ip_1 = "10.0.0.22"
    // release: v0.21.5-k3s2r1
    k3os_image = "https://github.com/rancher/k3os/releases/download/v0.21.5-k3s2r1/k3os-amd64.iso"
    metadata = {
      "ssh_authorized_keys" = join("\n", var.ssh_authorized_keys)
    }
  }

The two server nodes VM.Standard.A1.Flex are up and running fine.

I am stuck unfortunately and any help would be gratefully received :)

Also, are starting and destroying instances chargeable :)

It looks like the shape VM.Standard.E2.1.Micro isn't available in your region.

It looks like the shape VM.Standard.E2.1.Micro isn't available in your region.
You can check it by:
Go to Home > Governance > Limits, Quotas and Usage to see where your VM.Standard.E2.1.Micro shapes are available.

_Originally posted by @r0b2g1t in https://github.com/r0b2g1t/k3s-cluster-on-oracle-cloud-infrastructure/issues/2#issuecomment-1083209846_

For others, its available, but not in the availability domain set by the script.

Changing the AD, allowed the instance to be created.

Error: Self-referential block

Hi,

When I try to run TF plan command I get the following error:

terraform plan -out .tfplan
var.private_key_password
  Password for private key to use for signing

  Enter a value: 

module.network.data.oci_identity_availability_domain.ad: Reading...
module.network.data.oci_identity_availability_domain.ad: Read complete after 0s [id=ocid1.availabilitydomain.oc1..xxxxxx]
โ•ท
โ”‚ Error: Self-referential block
โ”‚ 
โ”‚   on compute/main.tf line 24, in resource "oci_core_instance" "server_0":
โ”‚   24:           server_0_ip = oci_core_instance.server_0.private_ip,
โ”‚ 
โ”‚ Configuration for oci_core_instance.server_0 may not refer to itself.
โ•ต
โ•ท
โ”‚ Error: Self-referential block
โ”‚ 
โ”‚   on compute/main.tf line 24, in resource "oci_core_instance" "server_0":
โ”‚   24:           server_0_ip = oci_core_instance.server_0.private_ip,
โ”‚ 
โ”‚ Configuration for oci_core_instance.server_0 may not refer to itself.

I had to change the network/data.tf ad_number = 1 just because the region af-johannesburg-1 doesn't allow/have ad_number=2

Any idea on how I can fix this?

security rules and kubectl

Your security rules are not allowing kubectl to reach the cluster externally.

Also the public ip of the machine would need to be added to its allowed cert/listeners.

Havn't looked into how your creating the K3s but:
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--tls-san x.x.x.x" sh -s -
with x.x.x.x being the public IP would give you access.

or edit what k3s is serving directly:
kubectl -n kube-system edit secrets/k3s-serving

Fails to create Core Instace

I'm using root user access key and then when I try to run the script it creates the network just fine but fails to create the actual instance.

โ•ท
โ”‚ Error: 404-NotAuthorizedOrNotFound
โ”‚ Provider version: 4.67.0, released on 2022-03-10.
โ”‚ Service: Core Instance
โ”‚ Error Message: Authorization failed or requested resource not found.
โ”‚ OPC request ID: f39808081be0c66f025ee81eb87dbf3a/37EFF46E0A38072AF67D0343D2CDAC94/4F30CD595B5C0CC47C715402A16EA37A
โ”‚ Suggestion: Either the resource has been deleted or service Core Instance need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
โ”‚
โ”‚
โ”‚   with module.compute.oci_core_instance.server_1,
โ”‚   on compute/main.tf line 1, in resource "oci_core_instance" "server_1":
โ”‚    1: resource "oci_core_instance" "server_1" {
โ”‚

What is Server Node 1?

scp rancher@<SERVER_NODE_1_PUBLIC_IP>:/etc/rancher/k3s/k3s.yaml ~/.kube/config

and what is server node 1?

The server-nodes are at the availability domain 2 (AD-2) and the agent node are created in AD-1.

Cannot you just say which processor arch is for the server and which one for the agent nudes?

Error: 404;NotAuthorizedOrNotFound - caused by hard-coded compute image IDs in the wrong region

A terraform apply throws this error:

โ”‚ Error: 404-NotAuthorizedOrNotFound, Authorization failed or requested resource not found.
โ”‚ Suggestion: Either the resource has been deleted or service Core Instance need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
โ”‚ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_instance 
โ”‚ API Reference: https://docs.oracle.com/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance 
โ”‚ Request Target: POST https://iaas.eu-amsterdam-1.oraclecloud.com/20160918/instances 
โ”‚ Provider version: 4.119.0, released on 2023-05-03.  
โ”‚ Service: Core Instance 
โ”‚ Operation Name: LaunchInstance 
โ”‚ OPC request ID: 74975954df7e642d81de039b4c702ba1/380DB4D8255D882C2E7CABB029A00BAF/93E0CE782AD76D87AF42585D88D0D369 
โ”‚ 
โ”‚ 
โ”‚   with module.compute.oci_core_instance.server_0,
โ”‚   on compute/main.tf line 1, in resource "oci_core_instance" "server_0":
โ”‚    1: resource "oci_core_instance" "server_0" {

Suggestion: instead of hard-coded into a locals section in the variables.tf file, use a data lookup using the correct region / shape.

Workaround: If anyone else is using the eu-amsterdam-1 region you can use these:

    // Canonical-Ubuntu-22.04-Minimal-aarch64-2023.04.18-0 eu-amsterdam-1
    source_id   = "ocid1.image.oc1.eu-amsterdam-1.aaaaaaaa4yojwha4rdsnagwul4ncgy45lx7q2g3pd5ru2io6rsx6pog35mfq"
    // Canonical-Ubuntu-20.04-Minimal-2023.04.19-0 eu-amsterdam-1
    source_id   = "ocid1.image.oc1.eu-amsterdam-1.aaaaaaaaml7w5cdrj2fzoa7yaaa4ynymkolvshyz3cc4rbxymk52kcwxt6ma"

If you're in another region, use the oci command to look them. You'll need your compartment ID.

oci compute image list --shape "VM.Standard.E2.1.Micro" --compartment-id ${YOUR_COMPARTMENT_ID}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.