0

我正在使用 OCI 上的 terraform 与 kubernetes_pod 提供程序创建 pod。它给出连接错误:发布“http://localhost/api/v1/namespaces/default/pods.dial tcp [::1]:80: connectex: No connection could be made because the target machine主动拒绝它。似乎terraform 指向 localhost 而不是 OCI K8 集群。provider.tf 文件包括:

provider "oci" {
  cluster_id = <cluster ocid>
  tenancy_ocid = <tenanacy ocid>
  user_ocid = <user ocid>
  private_key_path = <key path>
  fingerprint = <fingerprint>
  region = "us-ashburn-1"
}

.kube/config 文件设置为:

apiVersion: v1
kind: ""
clusters:
- name: <cluster name>
  cluster:
    server: <https://1.2.3:4>
    certificate-authority-data: <xxxxx>
users:
- name: <user name>
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      command: oci
      args:
      - ce
      - cluster
      - generate-token
      - --cluster-id
      - <cluster ocid>
      - --region
      - us-ashburn-1
      env: []
contexts:
- name: <context>
  context:
    cluster: <cluster>
    user: <user>
current-context: <context>
4

0 回答 0