elotl / kip

Virtual-kubelet provider running pods in cloud instances
Apache License 2.0
223 stars 14 forks source link

Use kubeconfig in cell controller #157

Closed ldx closed 4 years ago

ldx commented 4 years ago

Allow using a kubeconfig file for API server access. The main change is to configure the cell controller via kubeconfig instead of using InClusterConfig() if a kubeconfig file is provided to Kip.

I also refactored the way we create the network agent kubeconfig, adding support for loading the same or another kubeconfig file instead of creating one from a service account secret.

Node-cli only supports an environment variable and no command line option:

    env:
    - name: KUBECONFIG
      value: /etc/kip/kubeconfig

For the network agent kubeconfig, I added --network-agent-kubeconfig.

Example, using one kubeconfig file that will be used by Kip and also the network agent on cells:

  containers:
  - command:
    - /kip
    - --provider
    - kip
    - --provider-config
    - /etc/kip/provider.yaml
    - --network-agent-kubeconfig
    - /etc/kip/kubeconfig
    env:
    - name: KUBECONFIG
      value: /etc/kip/kubeconfig