Giter Club home page Giter Club logo

oke-free's Introduction

Criando um Cluster Kubernetes na OCI utilizando OpenTofu #MêsDoKubernetes

Crie uma conta gratuita na Oracle Cloud, e provisione um cluster Kubernetes utilizando o Terraform de forma simples e rápida.

Acesse este link e crie a sua conta

Pontos Importantes Antes de Começar

  • Devido limitações da conta gratuita, você provavelmente precisará realizar o upgrade para uma conta Pay As You Go para conseguir criar o cluster utilizando as instâncias gratuitas VM.Standard.A1.Flex. Você não será cobrado pelo uso de recursos gratuitos mesmo após o upgrade.

  • Crie um alerta na sua conta para não ser cobrado por acidente Budget.

  • Não altere o shape da instância utilizada no cluster, pois a única instância gratuita compatível com o OKE é a VM.Standard.A1.Flex.

Instalando o OpenTofu

  • GNU/Linux
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
chmod +x install-opentofu.sh
./install-opentofu.sh --install-method deb
rm install-opentofu.sh
  • Windows
Invoke-WebRequest -outfile "install-opentofu.ps1" -uri "https://get.opentofu.org/install-opentofu.ps1"
& .\install-opentofu.ps1 -installMethod standalone
Remove-Item install-opentofu.ps1

Instalando o OCI CLI

  • GNU/Linux
  1. Execute o comando de instalação:
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
  1. Quando solicitado para atualizar a variável PATH, digite yes e ele atualizará automaticamente o arquivo .bashrc ou .bash_profile. Se você utiliza um shell diferente, precisará informar o caminho para o OCI CLI (por exemplo, ~/zshrc).

  2. Reinicie sua sessão no terminal.

  3. Verifique a instalação.

oci -v
  • Windows
  1. Faça download do instalador MSI da CLI do OCI para Windows no GitHub Releases

  2. Execute o instalador e siga as instruções.

Instalando Kubectl - Kubernetes 1.28.2

  • GNU/Linux

Kubectl é quem faz a comunicação com a API Kubernetes usando CLI. Devemos usar a mesma versão que está explicita no arquivo de variáveis. Veja variables.tf

  1. Baixando o binário kubectl
curl -LO https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl
  1. Instalando o binário
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  1. Adicione kubectl completion bash
echo '
source <(kubectl completion bash)' >> ~/.bashrc
  1. Valide a versão
kubectl version --client
  • Note: O comando acima irá gerar um aviso: "WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short."

Você pode ignorar este aviso. Você está apenas verificando a versão do kubectl que instalou.

  • Windows
  1. Baixe o binário kubectl
curl.exe -LO "https://dl.k8s.io/release/v1.28.2/bin/windows/amd64/kubectl.exe"
  1. Anexe a pasta binária kubectl à sua variável de ambiente PATH.

  2. Valide a versão

kubectl version --client --output=yaml

🔗 Guia de instalação para todos os ambientes

Autenticando na OCI

  1. Antes de começar, clone o repositório.
git clone https://github.com/Rapha-Borges/oke-free.git
  1. Crie uma API key
  • Entre no seu perfil, acesse a aba API Keys e clique em Add API Key.
  1. Selecione Generate API key pair, faça o download da chave privada. Em seguida, clique em Add.

  2. Após o download, mova a chave para o diretório do OCI CLI e renomeie para oci_api_key.pem.

  • GNU/Linux
mkdir -p ~/.oci && mv ~/Downloads/<nome_do_arquivo>.pem ~/.oci/oci_api_key.pem
  • Windows
move C:\Users\<user>\Downloads\<nome_do_arquivo>.pem C:\Users\<user>\.oci\oci_api_key.pem
  1. Corrija as permissões da chave privada:
oci setup repair-file-permissions --file <caminho_da_chave_privada>
  1. Copie o texto que apareceu na página de criação da API KEY para o arquivo de configuração do OCI CLI. Não se esqueça de substituir o valor do compo key_file pelo caminho da chave privada.
  • GNU/Linux
vim ~/.oci/config
[DEFAULT]
user=ocid1.user.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fingerprint=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
tenancy=ocid1.tenancy.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region=xxxxxxxx
key_file=~/.oci/oci_api_key.pem
  • Windows
notepad C:\Users\<user>\.oci\config
[DEFAULT]
user=ocid1.user.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fingerprint=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
tenancy=ocid1.tenancy.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region=xxxxxxxx
key_file=C:\Users\<user>\.oci\oci_api_key.pem
  1. Crie a pasta ./ssh e gere a chave ssh (No Windows, utilize o Git Bash para executar o comando abaixo).
ssh-keygen -t rsa -b 4096 -f ./ssh/id_rsa
  1. Crie o arquivo com as variáveis de ambiente, substituindo os valores das variáveis pelos valores da sua conta (o conteúdo usado no arquivo ~/.oci/config acima).
  • GNU/Linux
vim ./env.sh
export TF_VAR_tenancy_ocid=<your tenancy ocid>
export TF_VAR_user_ocid=<your user ocid>
export TF_VAR_fingerprint=<your fingerprint>
export TF_VAR_private_key_path=~/.oci/oci_api_key.pem
export TF_VAR_ssh_public_key=$(cat ssh/id_rsa.pub)
# Optional if you want to use a different profile name change the value below
export TF_VAR_oci_profile="DEFAULT"

Agora rode o script para exportar as variáveis:

source ./env.sh
  • Windows

No Windows, você pode criar um arquivo env.bat com o conteúdo abaixo e executar o arquivo para exportar as variáveis.

set TF_VAR_tenancy_ocid=<your tenancy ocid>
set TF_VAR_user_ocid=<your user ocid>
set TF_VAR_fingerprint=<your fingerprint>
set TF_VAR_private_key_path=C:\Users\<user>\.oci\oci_api_key.pem
set TF_VAR_ssh_public_key=C:\Users\<user>\.oci\ssh\id_rsa.pub
# Optional if you want to use a different profile name change the value below
set TF_VAR_oci_profile="DEFAULT"

Agora execute o arquivo para exportar as variáveis:

env.bat

Criando o cluster

  1. Instale os módulos
tofu init
  1. Crie o cluster.
tofu apply
  • OBS: Opicionalmente, você pode utilizar o comando tofu plan para visualizar as alterações que serão realizadas antes de executar o tofu apply. Com os seguintes comandos:
tofu plan -out=oci.tfplan
tofu apply -auto-approve "oci.tfplan"
  1. Edite o arquivo ~/.kube/config para adicionar a autenticação com a API KEY conforme exemplo abaixo.
- name: user-xxxxxxxxxx
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      command: oci
      args:
      - ce
      - cluster
      - generate-token
      - --cluster-id
      - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - --region
      - xxxxxxxxxxx
      - --auth            # ADICIONE ESSA LINHA
      - api_key           # ADICIONE ESSA LINHA
      - --profile         # ADICIONE ESSA LINHA
      - DEFAULT           # ADICIONE ESSA LINHA
  1. Acesse o cluster.
kubectl get nodes

Script para criação do cluster

Atenção: O script está em fase de testes e funciona apenas no Linux.

Caso queira automatizar o processo de criação do cluster, basta executar o script main.sh que está na raiz do projeto. O script irá gerar a chave SSH, adicionar a chave pública na TF_VAR, inicializar o Terraform e criar o cluster.

./main.sh

Load Balancer

O cluster que criamos já conta com um Network Load Balancer configurado para expor uma aplicação na porta 80. Basta configurar um serviço do tipo NodePort com a porta 80 e a nodePort 30080. Exemplos de como configurar o serviço podem ser encontrados no diretório manifests.

O endereço do Load Balancer é informado na final da execução, no formato public_ip = "xxx.xxx.xxx.xxx" e pode ser consultado a qualquer momento com o comando:

tofu output public_ip

Deletando o cluster

  1. Para deletar o cluster bastar executar o comando:
tofu destroy

Problemas conhecidos

  • Se você tentar criar um cluster com uma conta gratuita e receber o erro abaixo

Error: "Out of capacity" ou "Out of host capacity"

As contas gratuitas tem um número limitado de instâncias disponíveis, possivelmente a região que você está tentando criar o cluster não tem mais instâncias disponíveis. Você pode esperar até que novas instâncias fiquem disponíveis ou tentar criar o cluster em outra região. Além disso, o upgrade para uma conta Pay As You Go pode resolver o problema, pois as contas Pay As You Go tem um número maior de instâncias disponíveis. Você não será cobrado pelo uso de recursos gratuitos mesmo após o upgrade.

  • Erro 401-NotAuthenticated ou o comando kubectl não funciona. Isso ocorre porque o token de autenticação expirou

Gere um novo token de autenticação e exporte para a variável de ambiente OCI_CLI_AUTH.

oci session authenticate --region us-ashburn-1
  • Linux
export OCI_CLI_AUTH=security_token
  • Windows
set OCI_CLI_AUTH=security_token
  • Erros devido a falha na execução do tofu destroy, impossibilitando a exclusão do cluster e todos os recursos. Ou erros como o Error Code: CompartmentAlreadyExists que não são resolvidos com o tofu destroy

Para resolver esse problema, basta deletar os recursos manualmente no console da OCI. Seguindo a ordem abaixo:

Obs: Caso não apareça o Cluster ou a VPN para deletar, certifique que selecionou o Compartment certo k8s.

Referências

Criado por @Raphael Borges

oke-free's People

Contributors

arthurhenrique avatar bfeliano avatar dependabot[bot] avatar dsgrilo avatar gitbarnabedikartola avatar ivancsantos avatar mmazoni avatar muritadb avatar pedr0prs avatar phsmith avatar rapha-borges avatar soaresnetoh avatar vininhos 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

oke-free's Issues

Atualização para Manter Conformidade com o Always Free

Devido à utilização inicial das instâncias "VM.Standard.E3.Flex" para o laboratório, que são instâncias pagas, e só conseguimos acesso gratuito graças ao apoio da Oracle Cloud, estamos atualizando o cluster para utilizar as instâncias Always Free "VM.Standard.A1.Flex".

Se você possuir créditos e quiser continuar utilizando as instâncias "VM.Standard.E3.Flex", não há problema algum. No entanto, lembre-se de migrar antes do término dos créditos para evitar qualquer cobrança.

Além disso, nos próximos dias, planejamos migrar o cluster de OKE para um cluster não gerenciado. Essa mudança proporcionará maior liberdade e nos permitirá explorar mais ferramentas de estudo, mantendo a conformidade com a proposta do Always Free.

Todo o processo de migração estará disponível neste repositório e será feito da forma mais simples possível.

Nova branch para testes do cluster always-free

Criei a branch always-free para testar o cluster utilizando apenas recursos gratuitos. No entanto, para realizar esse procedimento, você possivelmente precisará fazer o upgrade da conta para Pay As You Go para ter acesso à maior disponibilidade das instâncias VM.Standard.A1.Flex (único shape Always Free compatível com o OKE).

Fique atento ao utilizar o cluster dessa forma, pois outros recursos, não inclusos no Always Free, podem ser criados dependendo de como você utiliza a sua conta.

Por se tratar de um projeto colaborativo, mesmo que revisado por mim, não me responsabilizo por custos gerados devido à utilização desse laboratório. Sempre crie um alerta de custos no valor de R$ 1,00 para não ter surpresas.

Screenshot from 2024-01-23 00-26-01

Screenshot from 2024-01-23 00-24-36

photo_2024-01-23_00-31-08

error 409

Error: 409-Conflict, Kubernetes version does not match Kubernetes version of OKE worker node image (v1.26.7)
│ Suggestion: The resource is in a conflicted state. Please retry again or contact support for help with service: Containerengine Node Pool
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/containerengine_node_pool
│ API Reference: https://docs.oracle.com/iaas/api/#/en/containerengine/20180222/NodePool/CreateNodePool
│ Request Target: POST https://containerengine.us-ashburn-1.oci.oraclecloud.com/20180222/nodePools
│ Provider version: 5.25.0, released on . This provider is 15250 Update(s) behind to current.
│ Service: Containerengine Node Pool
│ Operation Name: CreateNodePool
│ OPC request ID: d6b5f9e51d4def473b9210efc46ee8d7/44852AB8B6E1134F8B6D9822B7E3E7C1/F13CAA5C066F9783CD4F962FEC2D5920


│ with module.cluster.oci_containerengine_node_pool.k8s_node_pool,
│ on cluster\k8s.tf line 29, in resource "oci_containerengine_node_pool" "k8s_node_pool":
│ 29: resource "oci_containerengine_node_pool" "k8s_node_pool" {

Erro status critical no Load Balancer

Ao realizar o processo de apply todo processo se constrói como o esperado, porem observei os seguinte erro abaixo:
Erro loadbalancer

Que creio que seja o motivo por minha stack(prometheus/grafana) não estejam ficando disponíveis.

Se puder da uma força @Rapha-Borges

k8s_cluster: Error 400-LimitExceeded, The cluster limit for this tenancy has been exceeded

Olá boa tarde.

Estou abrindo essa Issue por que não vi ninguém relatando este problema.

Basicamente segui todos os passos, mas no momento do "terraform apply", recebi o seguinte erro:

module.cluster.oci_containerengine_cluster.k8s_cluster: Creating...

│ Error: 400-LimitExceeded, The cluster limit for this tenancy has been exceeded.
│ Suggestion: Request a service limit increase for this resource Containerengine Cluster
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/containerengine_cluster
│ API Reference: https://docs.oracle.com/iaas/api/#/en/containerengine/20180222/Cluster/CreateCluster
│ Request Target: POST https://containerengine.us-ashburn-1.oci.oraclecloud.com/20180222/clusters
│ Provider version: 5.24.0, released on 2024-01-10.
│ Service: Containerengine Cluster
│ Operation Name: CreateCluster
│ OPC request ID: 0996e580ca47473ebafa919e706e384c/8DC7642CACC01A8ED5F8923BE728098B/5D3E928F4B5B85C3C3F7067E6E294A3B


│ with module.cluster.oci_containerengine_cluster.k8s_cluster,
│ on cluster/k8s.tf line 5, in resource "oci_containerengine_cluster" "k8s_cluster":
│ 5: resource "oci_containerengine_cluster" "k8s_cluster" {



│ Error: 400-InvalidParameter, The maximum limit of 0 for Service gateway per VCN has been exceeded in VCN ocid1.vcn.oc1.iad.amaaaaaaxehdrqqatvmp54jvjuddemvdf5byt2vwe4javbmqyjz4kcb5h6ta.
│ Suggestion: Please update the parameter(s) in the Terraform config as per error message The maximum limit of 0 for Service gateway per VCN has been exceeded in VCN ocid1.vcn.oc1.iad.amaaaaaaxehdrqqatvmp54jvjuddemvdf5byt2vwe4javbmqyjz4kcb5h6ta.
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_service_gateway
│ API Reference: https://docs.oracle.com/iaas/api/#/en/iaas/20160918/ServiceGateway/CreateServiceGateway
│ Request Target: POST https://iaas.us-ashburn-1.oraclecloud.com/20160918/serviceGateways
│ Provider version: 5.23.0, released on . This provider is 15250 Update(s) behind to current.
│ Service: Core Service Gateway
│ Operation Name: CreateServiceGateway
│ OPC request ID: 37eafd91a88c1288604e6ae69346ee41/DCED4039D255C04998FDEF2D4D56406C/17E9103A03C85D5AB538173DB3D01153


│ with module.vcn.oci_core_service_gateway.service_gateway[0],
│ on .terraform/modules/vcn/vcn_gateways.tf line 127, in resource "oci_core_service_gateway" "service_gateway":
│ 127: resource "oci_core_service_gateway" "service_gateway" {



│ Error: 400-LimitExceeded, NAT gateway limit per VCN reached
│ Suggestion: Request a service limit increase for this resource Core Nat Gateway
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_nat_gateway
│ API Reference: https://docs.oracle.com/iaas/api/#/en/iaas/20160918/NatGateway/CreateNatGateway
│ Request Target: POST https://iaas.us-ashburn-1.oraclecloud.com/20160918/natGateways
│ Provider version: 5.23.0, released on . This provider is 15250 Update(s) behind to current.
│ Service: Core Nat Gateway
│ Operation Name: CreateNatGateway
│ OPC request ID: ebd225730a96b9012571cca73909321a/806FF145714C57537AD724EA5CEF0C86/6DE947BA02D49CECC52BE7CEFC45C05F


│ with module.vcn.oci_core_nat_gateway.nat_gateway[0],
│ on .terraform/modules/vcn/vcn_gateways.tf line 177, in resource "oci_core_nat_gateway" "nat_gateway":
│ 177: resource "oci_core_nat_gateway" "nat_gateway" {

Obs: alguns recursos foram criados com sucesso, mas quando chegou nesses em específico ocorreu essa falha.

Entendo ser um erro de limite de recursos atingidos, diferente do erro de "out of capacity" que outras pessoas relataram.

Mais alguém obteve esse problema? saberiam como posso resolver?

Detalhe, estou usando uma conta pessoal que eu já tinha na OCI, criada a alguns meses atrás, ele está habilitada sem cartão e no modo free tier, tinha entendido pela documentação que o lab iria funcionar da mesma forma por que todos os recursos criados seriam dentro do free tier e não teriam recursos que consumiriam créditos, mas caso o problema seja relacionado a créditos, peço que me avisem também aí posso tentar correr atrás de criar outra conta

module.kubeconfig.null_resource.create_kubeconfig: Provisioning with 'local-exec'...

module.kubeconfig.null_resource.create_kubeconfig: Provisioning with 'local-exec'...
module.kubeconfig.null_resource.create_kubeconfig (local-exec): Executing: ["/bin/sh" "-c" "oci ce cluster create-kubeconfig --cluster-id ocid1.cluster.oc1.iad.aaaaaaaahbxg37kqjejgkm2who3buj6nsk5tvvqiv6nylfb3hctnhjgskmva --file ~/.kube/config --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT --profile DEFAULT"]
module.kubeconfig.null_resource.create_kubeconfig (local-exec): MissingSectionHeaderError: File contains no section headers.
module.kubeconfig.null_resource.create_kubeconfig (local-exec): file: '/home/tsantos/.oci/config', line: 1
module.kubeconfig.null_resource.create_kubeconfig (local-exec): 'er=ocid1.user.oc1..aaaaaaaacqf2fuktec7mxzihhzglspyqa4ut7ry5viaxx56qpqbewckpfe7q\n'

│ Error: local-exec provisioner error

│ with module.kubeconfig.null_resource.create_kubeconfig,
│ on kubeconfig/kubeconfig.tf line 2, in resource "null_resource" "create_kubeconfig":
│ 2: provisioner "local-exec" {

│ Error running command 'oci ce cluster create-kubeconfig --cluster-id ocid1.cluster.oc1.iad.aaaaaaaahbxg37kqjejgkm2who3buj6nsk5tvvqiv6nylfb3hctnhjgskmva --file ~/.kube/config --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT --profile DEFAULT': exit
│ status 1. Output: MissingSectionHeaderError: File contains no section headers.
│ file: '/home/tsantos/.oci/config', line: 1
│ 'er=ocid1.user.oc1..aaaaaaaacqf2fuktec7mxzihhzglspyqa4ut7ry5viaxx56qpqbewckpfe7q\n'

ao dar tofu apply pede variaveis

Eu tinha tentado fazer o passo-a-passo na semana que lançou o repo, utilizando o windows, mas nao obtive sucesso. Estava tentando fazer pelo PopOS porém na parte de dar o tofu apply ele me pede as variaveis.

image

eu criei o env.sh e rodei. Testei com o comando printenv e estavam aparecendo, to meio que sem ter pra onde correr já

P.S.: só consegui dar init e tentar dar apply como sudo, senao dava mensagem sobre permissoes do terraform.

Error: 400-LimitExceeded, The following service limits were exceeded: compartment-count. Request a service limit increase from the service limits page in the console

Ao realizar o tf apply ocorre esse erro.

│ Error: 400-LimitExceeded, The following service limits were exceeded: compartment-count. Request a service limit increase from the service limits page in the console.
│ Suggestion: Request a service limit increase for this resource Identity Compartment
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/identity_compartment
│ API Reference: https://docs.oracle.com/iaas/api/#/en/identity/20160918/Compartment/CreateCompartment
│ Request Target: POST https://identity.us-ashburn-1.oci.oraclecloud.com/20160918/compartments
│ Provider version: 5.24.0, released on 2024-01-10.
│ Service: Identity Compartment
│ Operation Name: CreateCompartment
│ OPC request ID: f45d3ee502de8e09448c35244b631559/C619B1F0F5F4B7A644A146EAE183B1F7/DC3555951ADDE07DE8D69E3AD07BCD73


│ with module.compartment.oci_identity_compartment.,
│ on compartment/compartment.tf line 1, in resource "oci_identity_compartment" "
":
│ 1: resource "oci_identity_compartment" "_" {

Error: Work Request error

Boa tarde, pessoal!

Durante o processo de criação do cluster recebi o seguinte erro após o git pull do repositório:

Error: Work Request error
│ Provider version: 5.24.0, released on 2024-01-10.
│ Service: Containerengine Node Pool
│ Error Message: work request did not succeed, workId: ocid1.clustersworkrequest.oc1.iad.aaaaaaaatax676brvddgtfibc5jd22lp4wrsskdzy644ifytpwvgcnlrf4ia, entity: nodepool, action: CREATED. Message: 1 nodes(s) register timeout. First, confirm that network prerequisites have been met. If network prerequisites have been met, troubleshoot the problem by running the Node Doctor script on the node(s) experiencing the issue, using either SSH or the Run Command feature. If you cannot resolve the issue using the troubleshooting output from the Node Doctor script, open a Service Request with My Oracle Support and upload the support bundle (a .tar file) to the support ticket. For more information, see https://docs.oracle.com/en-us/iaas/Content/ContEng/Concepts/contengnetworkconfig.htm and https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengtroubleshooting_topic-node_troubleshooting.htm
│ Resource OCID: ocid1.nodepool.oc1.iad.aaaaaaaa5tfnzdu2iwbyaanh4zi2fjibvfw6u3reog66hcdv3nnf3rpzs3ba
│ Suggestion: Please retry or contact support for help with service: Containerengine Node Pool


│ with module.cluster.oci_containerengine_node_pool.k8s_node_pool,
│ on cluster/k8s.tf line 29, in resource "oci_containerengine_node_pool" "k8s_node_pool":
│ 29: resource "oci_containerengine_node_pool" "k8s_node_pool" {

Destruí a infra e tentei novamente, tendo o mesmo resultado.
Poderiam ajudar?

Erro autenticação durante terraform destroy

Eu iniciei o cluster com a config antiga , e precisei destruir. Durante o processo acabou o tempo de autenticação dando Not Allowed durante o processo.

Error: Error returned by Identity Service. Http Status Code: 401. Error Code: NotAuthenticated. Opc request id: ade6de0fe06933bfb1942c1a20029167/22DC4E628A4E11601C4E1852908D173B/27F6D47C931AEE08DE3F62034C3F1844. Message: The required information to complete authentication was not provided or was incorrect. │ Operation Name: GetCompartment │ Timestamp: 2024-01-13 15:30:42 +0000 GMT │ Client Version: Oracle-GoSDK/65.55.1 │ Request Endpoint: GET https://identity.us-ashburn-1.oci.oraclecloud.com/20160918/compartments/ocid1.compartment.oc1..aaaaaaaakhplsucdounyq5wabc2zh5bjxj6zxrleywb5qcixp5sgleqtydaa │ Troubleshooting Tips: See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_401__401_notauthenticated for more information about resolving this error. │ Also see https://docs.oracle.com/iaas/api/#/en/identity/20160918/Compartment/GetCompartment for details on this operation's requirements. │ To get more info on the failing request, you can set OCI_GO_SDK_DEBUG env var to info or higher level to log the request/response details. │ If you are unable to resolve this Identity issue, please contact Oracle support and provide them this full error message. │

Mesmo renovando a autenticação não funcionou o terraform destroy.

Error: 403-NotAllowed, Deleting non active compartment or Listing active resources is not allowed. Compartment Id: ocid1.compartment.oc1..aaaaaaaakhplsucdounyq5wabc2zh5bjxj6zxrleywb5qcixp5sgleqtydaa │ Suggestion: Please retry or contact support for help with service: Identity Compartment │ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/identity_compartment │ API Reference: https://docs.oracle.com/iaas/api/#/en/identity/20160918/Compartment/DeleteCompartment │ Request Target: DELETE https://identity.us-ashburn-1.oci.oraclecloud.com/20160918/compartments/ocid1.compartment.oc1..aaaaaaaakhplsucdounyq5wabc2zh5bjxj6zxrleywb5qcixp5sgleqtydaa │ Provider version: 5.24.0, released on 2024-01-10. │ Service: Identity Compartment │ Operation Name: DeleteCompartment │ OPC request ID: 1cbcd0cf5cdff694ed6a1909c39963b7/C2BB3C70A037C3E9A562A03BB535A748/00D7E162378D111C1960E46541CBF7E8 │

tentando iniciar em outra pasta, clonando novamente o repo também não funcionou

Error: Error returned by Identity Service. Http Status Code: 409. Error Code: CompartmentAlreadyExists. Opc request id: 20a48953c88cfd117953a442d27ba187/F03D49332DA8C5C1BC1158D2F0DBB04B/B4CD4D3FAA16E6870187776A47C1FD5A. Message: Compartment 'k8s' already exists │ Operation Name: CreateCompartment │ Timestamp: 2024-01-13 15:37:04 +0000 GMT │ Client Version: Oracle-GoSDK/65.55.1 │ Request Endpoint: POST https://identity.us-ashburn-1.oci.oraclecloud.com/20160918/compartments │ Troubleshooting Tips: See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_409__409_compartmentalreadyexists for more information about resolving this error. │ Also see https://docs.oracle.com/iaas/api/#/en/identity/20160918/Compartment/CreateCompartment for details on this operation's requirements. │ To get more info on the failing request, you can set OCI_GO_SDK_DEBUG env var to info or higher level to log the request/response details. │ If you are unable to resolve this Identity issue, please contact Oracle support and provide them this full error message. │ │ If you define a compartment resource in your configurations with │ the same name as an existing compartment with 'enable_delete' set to 'true', │ the compartment will no longer be automatically imported. │ If you intended to manage an existing compartment, use terraform import instead. │ │ with module.compartment.oci_identity_compartment._, │ on compartment/compartment.tf line 1, in resource "oci_identity_compartment" "_": │ 1: resource "oci_identity_compartment" "_" { │

se puderem dar uma luz

Erro ao criar o kubeconfig

Erro ao criar o kubeconfig

O cluster é criado normalmente utilizando API key, com as chaves ssh necessárias e com as variáveis de ambiente corretas, porém no último passo encontro o seguinte problema:

module.kubeconfig.null_resource.create_kubeconfig: Creating...
module.kubeconfig.null_resource.create_kubeconfig: Provisioning with 'local-exec'...
module.kubeconfig.null_resource.create_kubeconfig (local-exec): Executing: ["/bin/sh" "-c" "oci ce cluster create-kubeconfig --cluster-id ocid1.cluster.oc1.iad.aaaaaaaa2jpkpeevaczuvpvfyiz5eqjtkisrqt662mgenvd43c5aenv6m37a --file ~/.kube/config --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT --profile DEFAULT"]
module.kubeconfig.null_resource.create_kubeconfig (local-exec): ServiceError:
module.kubeconfig.null_resource.create_kubeconfig (local-exec): {
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "client_version": "Oracle-PythonSDK/2.116.0, Oracle-PythonCLI/3.36.2",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "code": "NotAuthenticated",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "logging_tips": "Please run the OCI CLI command using --debug flag to find more debug information.",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "message": "Failed to verify the HTTP(S) Signature",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "opc-request-id": "D48ED1C5DCF0468EA126CA69FF99571E/CA4121DE9F864F3C70D61CA9DA5D747A/F550EA6AB0831BF7A24ADCE751AD193C",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "operation_name": "create_kubeconfig",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "request_endpoint": "POST https://containerengine.us-ashburn-1.oci.oraclecloud.com/20180222/clusters/ocid1.cluster.oc1.iad.aaaaaaaa2jpkpeevaczuvpvfyiz5eqjtkisrqt662mgenvd43c5aenv6m37a/kubeconfig/content",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "status": 401,
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "target_service": "container_engine",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "timestamp": "2024-02-01T03:03:58.838124+00:00",
module.kubeconfig.null_resource.create_kubeconfig (local-exec):     "troubleshooting_tips": "See [https://docs.oracle.com/iaas/Content/API/References/apierrors.htm] for more information about resolving this error. If you are unable to resolve this issue, run this CLI command with --debug option and contact Oracle support and provide them the full error message."
module.kubeconfig.null_resource.create_kubeconfig (local-exec): }
╷
│ Error: local-exec provisioner error
│ 
│   with module.kubeconfig.null_resource.create_kubeconfig,
│   on kubeconfig/kubeconfig.tf line 2, in resource "null_resource" "create_kubeconfig":
│    2:   provisioner "local-exec" {
│ 
│ Error running command 'oci ce cluster create-kubeconfig --cluster-id
│ ocid1.cluster.oc1.iad.aaaaaaaa2jpkpeevaczuvpvfyiz5eqjtkisrqt662mgenvd43c5aenv6m37a --file ~/.kube/config --token-version 2.0.0
│ --kube-endpoint PUBLIC_ENDPOINT --profile DEFAULT': exit status 1. Output: ServiceError:
│ {
│     "client_version": "Oracle-PythonSDK/2.116.0, Oracle-PythonCLI/3.36.2",
│     "code": "NotAuthenticated",
│     "logging_tips": "Please run the OCI CLI command using --debug flag to find more debug information.",
│     "message": "Failed to verify the HTTP(S) Signature",
│     "opc-request-id": "D48ED1C5DCF0468EA126CA69FF99571E/CA4121DE9F864F3C70D61CA9DA5D747A/F550EA6AB0831BF7A24ADCE751AD193C",
│     "operation_name": "create_kubeconfig",
│     "request_endpoint": "POST https://containerengine.us-ashburn-1.oci.oraclecloud.com/20180222/clusters/ocid1.cluster.oc1.iad.aaaaaaaa2jpkpeevaczuvpvfyiz5eqjtkisrqt662mgenvd43c5aenv6m37a/kubeconfig/content",
│     "status": 401,
│     "target_service": "container_engine",
│     "timestamp": "2024-02-01T03:03:58.838124+00:00",
│     "troubleshooting_tips": "See [https://docs.oracle.com/iaas/Content/API/References/apierrors.htm] for more information about resolving this error. If you are unable to resolve this issue, run this CLI command with --debug option and contact Oracle support and provide them the full error message."
│ }
│ 

Estou tentando esse problema.

module.cluster.oci_containerengine_node_pool.k8s_node_pool: Still creating... [1m0s elapsed]
module.cluster.oci_containerengine_node_pool.k8s_node_pool: Still creating... [1m10s elapsed]

│ Error: Work Request error
│ Provider version: 5.29.0, released on 2024-02-15.
│ Service: Containerengine Node Pool
│ Error Message: work request did not succeed, workId: ocid1.clustersworkrequest.oc1.iad.aaaaaaaa6kwpbat5wl42zlqx3rhjyldc5b5rlwo2klbfkshlswivbfuqwumq, entity: nodepool, action: CREATED. Message: 2 node(s) launch failure. Reason for failure on one of the nodes : Error returned by Unknown operation operation in Unknown service service.(500, InternalError, false) Out of host capacity. (opc-request-id: 3CB6F935FDD14DDF84A46620FAE6E3B0/FDEF32254979E4BF90CFC5E8E58A3EFA/8FF13BA29C359FFA65A33D0D99D4C5A5)
│ Timestamp: 2024-02-21T13:51:55.828Z
│ Client version: Oracle-JavaSDK/2.66.1
│ Request Endpoint: Unknown request endpoint
│ Troubleshooting Tips: See https://docs.oracle.com/en-us/iaas/Content/API/References/apierrors.htm#apierrors_500__500_internalerror for more information about resolving this errorre information about resolving this error
│ Also see Unknown API reference link for details on this operation's requirements. s.oracle.com/en-us/iaas/Content/API/SDKDocs/javasdkconfig.htm.
│ To get more info on the failing request, you can enable debug level logs as mentioned in Using SLF4J for Logging section in https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/javasdkconfig.htm.
│ If you are unable to resolve this Unknown service issue, please contact Oracle support and provide them this full error message.
│ Resource OCID: ocid1.nodepool.oc1.iad.aaaaaaaawdbfvnpttx5vzdd7xoexfxi3td3bzcqp7s6pphjbnnl7ymkzu5aa
│ Suggestion: Please retry or contact support for help with service: Containerengine Node Pool


│ with module.cluster.oci_containerengine_node_pool.k8s_node_pool,
│ on cluster/k8s.tf line 29, in resource "oci_containerengine_node_pool" "k8s_node_pool":
│ 29: resource "oci_containerengine_node_pool" "k8s_node_pool" {

Migrar o projeto para OpenTofu

  • Inserir um guia passo a passo para a instalação do OpenTofu.
  • Substituir os comandos terraform por tofu.
  • Validar procedimento de instalação
  • Revisar README

Adicionar Ingress como exemplo de uso

Atualmente temos duas opções de implementação para o Ingress Controller. Será necessário revisar ambas e decidir qual delas será adotada como padrão no repositório:

Após a escolha da implementação, alguns passos devem ser validados antes da conclusão do merge:

  • Validar arquivos YAML
  • Executar testes utilizando o cluster criado nesse repositório
  • Criar/revisar documentação de como implementar e configurar o Ingress

Revisar e Ajustar Comandos para Execução no Ambiente Windows

Alguns comandos requerem ajustes para assegurar a execução correta no ambiente Windows.

A tarefa envolve a revisão e correção dos comandos pertinentes para garantir sua compatibilidade e funcionalidade no ambiente Windows. Certifique-se de levar em consideração as peculiaridades e requisitos específicos deste sistema operacional ao efetuar modificações nos comandos.

Comandos ausentes:

  • Exportar o arquivo id_rsa.pub para TF_VAR_ssh_public_key no item 2 do processo Criando o cluster
  • Exportar o OCI_CLI_AUTH após o refresh do token no item 3 do processo Criando o cluster
  • Validar instalação do Terrafom
  • Validar instalação do OCI CLI
  • Validar instalação do Kubectl
  • Add caminho para editar o arquivo kubeconfig (Criando o Cluster - Step 3)

Erro 404

Fala Rapha! Estou tomando o erro:

Error: 400-InvalidParameter, Identity DP service returned a 404: 'Compartment id 'ocid1.tenancy.oc1..aaaaaaaah3ncz6tkctx5fp4tgmk6uag6qws33s2y753yohhvkndujqmjav2a' not found'
│ Suggestion: Please update the parameter(s) in the Terraform config as per error message Identity DP service returned a 404: 'Compartment id 'ocid1.tenancy.oc1..aaaaaaaah3ncz6tkctx5fp4tgmk6uag6qws33s2y753yohhvkndujqmjav2a' not found'

Work Request error

Estou recebendo o seguinte erro no momento de dar o apply no terraform:

Error: Work Request error
│ Provider version: 5.24.0, released on 2024-01-10.
│ Service: Containerengine Node Pool
│ Error Message: work request did not succeed, workId: ocid1.clustersworkrequest.oc1.iad.aaaaaaaa3zzu6fkjsjhdp2h5pgmxepgu3fxjzokgqvwl3f7krwhxkf763ggq, entity: nodepool, action: CREATED. Message: 1 nodes(s) register timeout. First, confirm that network prerequisites have been met. If network prerequisites have been met, troubleshoot the problem by running the Node Doctor script on the node(s) experiencing the issue, using either SSH or the Run Command feature. If you cannot resolve the issue using the t

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.