Skip to content

Hardcoded HOST_IP in agent-injector does not work on fresh clusters. #734

@simonostendorf

Description

@simonostendorf

Describe the bug

Currently the Agent Injector Pod Template has a hardcoded env var HOST_IP that is used to inject the status.hostIP into the container.
This value does not exist on a fresh cluster without a cloud-controller-manager installed. This results in a Init:CreateContainerConfigError error.

This is pretty bad because vault-agent-injector cannot be used to provide secrets for the cloud-controller-manager (anymore).

To Reproduce
Steps to reproduce the behavior:

  1. Create new Kubernetes cluster and dont install anything (e.g. using 1.32.1)
  2. Node has no internal or external ip set because its waiting for the cloud-controller-manager
  3. Install vault-agent-injector
  4. Install cloud-controller-manager with vault injection annotations
  5. Pod fails with Init:CreateContainerConfigError error because HOST_IP cannot be set because there is no host ip

Expected behavior

I think it would be good to make this optional (if its possible) or allow specification of injection templates or if the variable is not used inside the agent-injector it could be removed.

Environment

  • Kubernetes version: kubeadm 1.32.1
  • vault-k8s version: 1.18.1

Additional context

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions