> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/solutions/pf9ctl-binary-incorrectly-updating-proxy-settings.md).

# pf9ctl Binary Incorrectly Updating Proxy Settings

## Problem

* While updating proxy settings with the **pf9ctl** binary, the `/opt/pf9/hostagent/pf9-hostagent.env` file is being updated incorrectly.

Environment

* Platform9 Managed Kubernetes - v5.9 through v5.11
* pf9ctl

## Diagnosis

* Before applying `pf9ctl set-proxy` the file `/opt/pf9/hostagent/pf9-hostagent.env` looks like below.

{% tabs %}
{% tab title="Bash" %}

```bash
$ cat /opt/pf9/hostagent/pf9-hostagent.env
PYTHONPATH="/opt/pf9/hostagent/lib/python3.6/site-packages:/opt/pf9/hostagent/lib/python3.9/site-packages/bbslave:${PYTHONPATH}"
PYTHON_EGG_CACHE=/tmp/python-eggs
LD_LIBRARY_PATH="/opt/pf9/python/pf9-lib:/opt/pf9/python/pf9-hostagent-lib:${LD_LIBRARY_PATH}"
```

{% endtab %}
{% endtabs %}

* Setup proxy settings with `pf9ctl` on Node.

{% tabs %}
{% tab title="pf9ctl command" %}

```bash
$ pf9ctl set-proxy --protocol http --host-ip [IP_ADDRESS_1] --port [PORT] --no-proxy [IP_ADDRESS_2],[IP_ADDRESS_3]
```

{% endtab %}
{% endtabs %}

* After applying `pf9ctl set-proxy` the file `/opt/pf9/hostagent/pf9-hostagent.env` looks like below.

{% tabs %}
{% tab title="Bash" %}

```bash
$ cat /opt/pf9/hostagent/pf9-hostagent.env
PYTHONPATH="/opt/pf9/hostagent/lib/python3.6/site-packages:/opt/pf9/hostagent/lib/python3.9/site-packages/bbslave:${PYTHONPATH}"
PYTHON_EGG_CACHE=/tmp/python-eggs
LD_LIBRARY_PATH="/opt/pf9/python/pf9-lib:/opt/pf9/python/pf9-hostagent-lib:${LD_LIBRARY_PATH}"
export http_proxy=http://[IP_ADDRESS_1]:[PORT]
export https_proxy=http://[IP_ADDRESS_1]:[PORT]
export HTTP_PROXY=http://[IP_ADDRESS_1]:[PORT]
export HTTPS_PROXY=http://[IP_ADDRESS_1]:[PORT]
export no_proxy=localhost,127.0.0.1,::1,localhost.localdomain,localhost4,localhost6
export NO_PROXY=localhost,127.0.0.1,::1,localhost.localdomain,localhost4,localhost6
```

{% endtab %}
{% endtabs %}

* Hostagent Logs on the node:

{% tabs %}
{% tab title="Hostagent Logs" %}

```ruby
bud2-otp-cp1 systemd[1]: pf9-hostagent.service: Ignoring invalid environment assignment 'export HTTPS_PROXY=http://[IP_ADDRESS_1]:[PORT]': /opt/pf9/hostagent/pf9-hostagent.env
bud2-otp-cp1 systemd[1]: pf9-hostagent.service: Ignoring invalid environment assignment 'export no_proxy=localhost,127.0.0.1,::1,localhost.localdomain,localhost4,localhost6': /opt/pf9/>
bud2-otp-cp1 systemd[1]: pf9-hostagent.service: Ignoring invalid environment assignment 'export NO_PROXY=localhost,127.0.0.1,::1,localhost.localdomain,localhost4,localhost6': /opt/pf9/>
```

{% endtab %}
{% endtabs %}

## Cause

* This is due to a BUG: **PMK-6577** and is resolved in **PMK v5.12.**

## Workaround

* Manually update `/opt/pf9/hostagent/pf9-hostagent.env` file with required environment variables.

{% tabs %}
{% tab title="Bash" %}

```bash
$ cat /opt/pf9/hostagent/pf9-hostagent.env
PYTHONPATH="/opt/pf9/hostagent/lib/python3.6/site-packages:/opt/pf9/hostagent/lib/python3.9/site-packages/bbslave:${PYTHONPATH}"
PYTHON_EGG_CACHE=/tmp/python-eggs
LD_LIBRARY_PATH="/opt/pf9/python/pf9-lib:/opt/pf9/python/pf9-hostagent-lib:${LD_LIBRARY_PATH}"
http_proxy=http://[IP_ADDRESS_1]:[PORT]
https_proxy=http://[IP_ADDRESS_1]:[PORT]
HTTP_PROXY=http://[IP_ADDRESS_1]:[PORT]
HTTPS_PROXY=http://[IP_ADDRESS_1]:[PORT]
no_proxy=127.0.0.1,localhost,[IP_ADDRESS_2],[IP_ADDRESS_3]
NO_PROXY=127.0.0.1,localhost,[IP_ADDRESS_2],[IP_ADDRESS_3]
```

{% endtab %}
{% endtabs %}

* Restart pf9-hostagent service.

{% tabs %}
{% tab title="Bash" %}

```bash
$ systemctl restart pf9-hostagent
```

{% endtab %}
{% endtabs %}

* Verify the proxy settings by fetching pod logs.

{% tabs %}
{% tab title="Kubectl Command" %}

```bash
$ kubectl logs <POD_NAME> -n <NAMESPACE>
```

{% endtab %}
{% endtabs %}

## Additional Information

* To learn more about configuring a proxy for PMK Cluster, please refer to this [KB article](https://platform9.com/kb/kubernetes/set-proxy-config-for-pmk-clusters).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmk/solutions/pf9ctl-binary-incorrectly-updating-proxy-settings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
