I have created a rancher server2.0 with the following items:
• Cluster- Cluster1 using the below command,
#Creating Cluster
CLUSTERRESPONSE=curl -s 'https://127.0.0.1/v3/cluster' -H 'content-type: application/json' -H "Authorization: Bearer $APITOKEN" --data-binary '{"type":"cluster","nodes":[],"rancherKubernetesEngineConfig":{"ignoreDockerVersion":false, "kubernetesVersion":"v1.9.5-rancher1-1", "services":{"etcd":{"extraArgs":{"election-timeout":"5000", "heartbeat-interval":"500"}}}, "network":{"type":"networkConfig", "plugin":"flannel"}, "authentication":{"type":"authnConfig", "strategy":"x509"}, "ingress":{"type":"ingressConfig", "provider":"nginx"}, "podSecurityPolicy":false},"name":"Cluster1"}' --insecure
echo $CLUSTERRESPONSE
• Nodes – etcd, controlplane and workers
Now the requirement is, I have to create a new cluster Cluster2 under the same rancher server from different host, so am using rancherIP instead of referring to localhost
• Cluster- Cluster2 using the below command,
#Creating Cluster
CLUSTERRESPONSE=curl -s 'https://$RANCHER2_SERVER_IP/v3/cluster' -H 'content-type: application/json' -H "Authorization: Bearer $APITOKEN" --data-binary '{"type":"cluster","nodes":[],"rancherKubernetesEngineConfig":{"ignoreDockerVersion":false, "kubernetesVersion":"v1.9.5-rancher1-1", "services":{"etcd":{"extraArgs":{"election-timeout":"5000", "heartbeat-interval":"500"}}}, "network":{"type":"networkConfig", "plugin":"flannel"}, "authentication":{"type":"authnConfig", "strategy":"x509"}, "ingress":{"type":"ingressConfig", "provider":"nginx"}, "podSecurityPolicy":false},"name":"Cluster2"}' --insecure
echo $CLUSTERRESPONSE
But am getting empty response, am using the same APITOKEN provided by the rancherserver for Cluster1.
Am I doing anything wrong? Please help.