AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 1147811
Accepted
Dolphin
Dolphin
Asked: 2023-11-14 14:15:19 +0800 CST2023-11-14 14:15:19 +0800 CST 2023-11-14 14:15:19 +0800 CST

Como alterar o endereço da API kube do contêiner inicial do cilium DeamonSet

  • 772

Estou usando o cilium 1.14.3 como o componente kuberenetes v1.28.3 cni, é assim que instalo o cilium:

helm install cilium cilium/cilium --version 1.14.3 \
   --namespace kube-system \
   --set global.nodeinit.enabled=true \
   --set global.kubeProxyReplacement=partial \
   --set global.hostServices.enabled=false \
   --set global.externalIPs.enabled=true \
   --set global.nodePort.enabled=true \
   --set global.hostPort.enabled=true \
   --set global.pullPolicy=IfNotPresent \
   --set config.ipam=kubernetes \
   --set global.hubble.enabled=true \
   --set global.hubble.relay.enabled=true \
   --set global.hubble.ui.enabled=true \
   --set global.hubble.metrics.enabled="{dns,drop,tcp,flow,port-distribution,icmp,http}"

agora quero alterar o endereço do servidor API do Kubernetes, editei o configmap cilium-config e adicionei isto:

  k8s-service-host: '172.29.217.209'
  k8s-service-port: '6443'
  k8s-api-server: 'https://172.29.217.209:6443'

esta configuração funciona para o operador cilium, mas descobri que o cilium DeamonSet ainda não usava o novo endereço do servidor API. Então adicionei a configuração no cilium DeamonSet assim:

initContainers:
        - name: config
          image: >-
            quay.io/cilium/cilium:v1.14.3@sha256:e5ca22526e01469f8d10c14e2339a82a13ad70d9a359b879024715540eef4ace
          command:
            - cilium
            - build-config
          env:
            - name: K8S_API_SERVER
              value: 'https://172.29.217.209:6443'
            - name: K8S_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: CILIUM_K8S_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
          resources: {}
          volumeMounts:
            - name: tmp
              mountPath: /tmp
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          imagePullPolicy: IfNotPresent

parece que o contêiner inicial não leu o endereço do servidor API. Estou esquecendo de algo? o que devo fazer para alterar o endereço do servidor kube api para o contêiner inicial cilium DeamonSet? Encontrei a configuração em https://docs.cilium.io/en/v1.12/gettingstarted/kubeproxy-free/#kubeproxy-free e acho que funcionará para 1.14.3.

este é o log de erros do contêiner inicial e mostra por que preciso alterar o endereço do servidor API:

level=info msg=Invoked duration="810.146µs" function="cmd.glob..func36 (build-config.go:32)" subsys=hive
level=info msg=Starting subsys=hive
level=info msg="Establishing connection to apiserver" host="https://10.96.0.1:443" subsys=k8s-client
level=info msg="Establishing connection to apiserver" host="https://10.96.0.1:443" subsys=k8s-client
level=error msg="Unable to contact k8s api-server" error="Get \"https://10.96.0.1:443/api/v1/namespaces/kube-system\": dial tcp 10.96.0.1:443: i/o timeout" ipAddr="https://10.96.0.1:443" subsys=k8s-client
level=error msg="Start hook failed" error="Get \"https://10.96.0.1:443/api/v1/namespaces/kube-system\": dial tcp 10.96.0.1:443: i/o timeout" function="client.(*compositeClientset).onStart" subsys=hive
level=info msg=Stopping subsys=hive
Error: failed to start: Get "https://10.96.0.1:443/api/v1/namespaces/kube-system": dial tcp 10.96.0.1:443: i/o timeout
Usage:
  cilium build-config --node-name $K8S_NODE_NAME [flags]

Flags:
      --allow-config-keys strings        List of configuration keys that are allowed to be overridden (e.g. set from not the first source. Takes precedence over deny-config-keys
      --deny-config-keys strings         List of configuration keys that are not allowed to be overridden (e.g. set from not the first source. If allow-config-keys is set, this field is ignored
      --dest string                      Destination directory to write the fully-resolved configuration. (default "/tmp/cilium/config-map")
      --enable-k8s                       Enable the k8s clientset (default true)
      --enable-k8s-api-discovery         Enable discovery of Kubernetes API groups and resources with the discovery API
  -h, --help                             help for build-config
      --k8s-api-server string            Kubernetes API server URL
      --k8s-client-burst int             Burst value allowed for the K8s client
      --k8s-client-qps float32           Queries per second limit for the K8s client
      --k8s-heartbeat-timeout duration   Configures the timeout for api-server heartbeat, set to 0 to disable (default 30s)
      --k8s-kubeconfig-path string       Absolute path of the kubernetes kubeconfig file
kubernetes
  • 1 1 respostas
  • 55 Views

1 respostas

  • Voted
  1. Best Answer
    thesNu
    2023-11-25T17:21:37+08:002023-11-25T17:21:37+08:00

    Golfinho. Como você está usando o Helm, é aconselhável executar o comando conforme a documentação (observe que estou me referindo à versão 1.14.4). Execute o seguinte comando de atualização do Helm para Cilium:

    helm upgrade cilium cilium/cilium --version 1.14.4 \
    --namespace kube-system \
    --set k8sServiceHost=YOUR_API_IP \
    --set k8sServicePort=6443
    

    Você pode encontrar todas as chaves relevantes na documentação aqui e não há mais uma chave k8s-api-server.

    Depois de executar isso, você pode usar o seguinte comando para inspecionar o Cilium DaemonSet:

    kubectl -n kube-system describe ds cilium
    

    Ao fazer isso, você deve observar o seguinte na saída:

    Init Containers:
     config:
      Image:     quay.io/cilium/cilium:v1.14.4@sha256:4981767b787c69126e190e33aee93d5a076639083c21f0e7c29596a519c64a2e
      Port:       <none>
      Host Port:  <none>
      Command:
       cilium
       build-config
      Environment:
        K8S_NODE_NAME:             (v1:spec.nodeName)
        CILIUM_K8S_NAMESPACE:      (v1:metadata.namespace)
        KUBERNETES_SERVICE_HOST:   YOUR_API_IP
        KUBERNETES_SERVICE_PORT:   6443
    

    Observe que você deve substituir YOUR_API_IP pelo endereço IP real em sua configuração específica.

    • 1

relate perguntas

  • Containerd falhou ao iniciar após Nvidia Config

  • Como posso modificar o configmap CoreDNS antes de inicializar o cluster usando o kubeadm?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve