Access and Test aapm-service Locally
4 min
kubectl port-forward temporarily exposes the service on the server's own 127.0.0.1 address. To access it from your own computer, an additional SSH tunnel is required.
Start a persistent port forward on the server
Without nohup ... & disown commands, this process terminates when the SSH session closes or the connection drops.
nohup kubectl port-forward svc/aapm-service 8443:8443 -n kron-pam-aapm > /tmp/pf-aapm-service.log 2>&1 < /dev/null &
disown
sleep 2
ss -tlnp | grep :8443Open an SSH tunnel from your own machine
ssh -N -L 8443:127.0.0.1:8443 <USER>@<SERVER_IP>On Windows, if ssh/sshpass is unavailable, PuTTY's plink.exe can be used instead:
plink.exe -ssh -batch -pw <PASSWORD> -N -L 8443:127.0.0.1:8443 <USER>@<SERVER_IP>Send a test request
With curl command:
curl -X POST http://localhost:8443/vault \
-H "Content-Type: application/json" \
-d '{
"accountName": "<ACCOUNT_NAME>",
"accountPath": "<ACCOUNT_PATH>",
"token": "<KRON_PAM_TOKEN>"
}'with Python:
import requests
url = "http://localhost:8443/vault"
headers = {"Content-Type": "application/json"}
payload = {
"accountName": "<ACCOUNT_NAME>",
"accountPath": "<ACCOUNT_PATH>",
"token": "<KRON_PAM_TOKEN>"
}
try:
response = requests.post(url, headers=headers, json=payload)
print(f"Status Code: {response.status_code}")
print(f"Response Body: {response.text}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")Success criteria: Status Code: 200 and a "password" field in the response body.