Created
February 12, 2024 14:38
-
-
Save clemenko/385d6ce697e1f7a4601dbfc24d9a87e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is for joining federated clusters within NeuVector | |
# check the passwords | |
export masterPassword=Pa22word | |
export masterUrl=neuvector.rfed.io | |
export masterApi=nv-api.rfed.io | |
export manangedPassword=admin | |
export managedUrl=nv2.rfed.io | |
export managedApi=nv2-api.rfed.io | |
# Master - create federation and get join token | |
TOKEN=$(curl -sk -H "Content-Type: application/json" https://$masterUrl/auth -d '{"isRancherSSOUrl":false, "username": "admin", "password": "'$masterPassword'"}' | jq -r .token.token) | |
curl -sk -H "Content-Type: application/json" -H 'Token: '$TOKEN https://$masterUrl/fed/promote -d '{"name":"'$masterUrl'","master_rest_info":{"server":"'$masterApi'","port":443},"use_proxy":"","deploy_repo_scan_data":false}' | |
TOKEN=$(curl -sk -H "Content-Type: application/json" https://$master_url/auth -d '{"isRancherSSOUrl":false, "username": "admin", "password": "'$password'"}' | jq -r .token.token) | |
JOIN_TOKEN=$(curl -sk -H "Content-Type: application/json" -H 'Token: '$TOKEN https:/$master_urlfed/join_token | jq -r .join_token) | |
# Managed - join | |
TOKEN=$(curl -sk -H "Content-Type: application/json" https://$managedUrl/auth -d '{"isRancherSSOUrl":false, "username": "admin", "password": "'$manangedPassword'"}' | jq -r .token.token) | |
curl -sk -H "Content-Type: application/json" -H 'Token: '$TOKEN https://$managedUrl/fed/join -d '{"name":"nv2","server":"'$masterApi'","port":443,"join_token":"'$JOIN_TOKEN'","joint_rest_info":{"server":"'$managedApi'","port":443},"use_proxy":""}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment