fence-agents icon indicating copy to clipboard operation
fence-agents copied to clipboard

Fence_aws: Proxy configurations not picked when used with STONITH

Open samsat22 opened this issue 2 years ago • 11 comments

Hi,

fence_aws agent able to fence the EC2 instances when ran with “fence_aws -o off <instance ID>” but when STONITH tries to fence instance the proxies set in environment variables are not picked and end in timeout.

samsat22 avatar Feb 14 '23 14:02 samsat22

The agent doesnt currently support proxies.

oalbrigt avatar Feb 14 '23 15:02 oalbrigt

Thanks for the information, will that be enabled anytime soon? Or is there any other workaround?

samsat22 avatar Feb 16 '23 05:02 samsat22

@samsat22 can you explain how did you set the proxy configuration?

gguifelixamz avatar Feb 20 '23 16:02 gguifelixamz

Set as Environment variable HTTP_PROXY, HTTPS_PROXY and also under /etc/profile.d/proxy.sh

samsat22 avatar Feb 20 '23 16:02 samsat22

@samsat22 I recommend you to set the env vars inside /etc/sysconfig/pacemaker, which is the right place to set it for the any pacemaker resource agent. After adding the entries you will need to restart your cluster.

For AWS, you will also include the EC2 instance metadata (169.254.169.254) in the no_proxy env var.

gguifelixamz avatar Feb 20 '23 17:02 gguifelixamz

@samsat22 updates?

gguifelixamz avatar Feb 27 '23 20:02 gguifelixamz

@gguifelixamz Not sure what is the variable value to be set in pacemaker config file like pcmk_host. I was able to resolve this timeout error by creating VPC endpoint.

The EC2 instance uses IAM role and the ~/.aws/credentials is created with below content, but still I get the error “Failed: Incorrect Access Key or Secret Key”

[default] region=us-east-1

Fencing status is success if the below command:

“fence_aws -o status -n <instance_id> -v

samsat22 avatar Feb 28 '23 13:02 samsat22

Example - the /etc/sysconfig/pacemaker file will look like this:

http_proxy=http://<proxy>:<proxy_port>
https_proxy=http://<proxy>:<proxy_port>
no_proxy="localhost,169.254.169.254"

Do you have an IAM Role attached to your EC2 instance? You either need an IAM role or IAM Access Keys configured in your fencing agent for it to work.

gguifelixamz avatar Feb 28 '23 19:02 gguifelixamz

Thanks! I will try the proxy modification.

Yes, I’ve the IAM role attached to EC2.

This is successful - fence_aws -o status -n <instance_id> -v

but stonith auto fencing fails with invalid access key and secret key.

samsat22 avatar Feb 28 '23 19:02 samsat22

What RHEL version are you using?

gguifelixamz avatar Feb 28 '23 20:02 gguifelixamz

RHEL8 @gguifelixamz

samsat22 avatar Feb 28 '23 20:02 samsat22