From 949897fd410ba74600fd44d2e81cef638b6f5a6c Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Tue, 28 Nov 2017 08:40:23 +0100 Subject: Use IP addresses for OpenStack nodes Unlike other cloud providers, OpenStack VMs are not able to resolve each other by their names. If you try to run the playbooks against nodes without a pre-created /etc/hosts or a DNS that provides the hostname/ip resolution, it will fail. By setting the `openshift_hostname` variable to each node's IP address, we're able to deploy a functional cluster without running a custom DNS. It is still possible to provide an external server with nsupdate keys and have it be populated, but that is no longer a hard requirement. --- playbooks/openstack/sample-inventory/group_vars/OSEv3.yml | 3 +-- playbooks/openstack/sample-inventory/group_vars/all.yml | 9 --------- playbooks/openstack/sample-inventory/inventory.py | 10 +++++++++- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'playbooks/openstack/sample-inventory') diff --git a/playbooks/openstack/sample-inventory/group_vars/OSEv3.yml b/playbooks/openstack/sample-inventory/group_vars/OSEv3.yml index 1e55adb9e..90608bbc0 100644 --- a/playbooks/openstack/sample-inventory/group_vars/OSEv3.yml +++ b/playbooks/openstack/sample-inventory/group_vars/OSEv3.yml @@ -5,8 +5,7 @@ openshift_deployment_type: origin openshift_master_default_subdomain: "apps.{{ openshift_openstack_clusterid }}.{{ openshift_openstack_public_dns_domain }}" openshift_master_cluster_method: native -openshift_master_cluster_hostname: "console.{{ openshift_openstack_clusterid }}.{{ openshift_openstack_public_dns_domain }}" -openshift_master_cluster_public_hostname: "{{ openshift_master_cluster_hostname }}" +openshift_master_cluster_public_hostname: "console.{{ openshift_openstack_clusterid }}.{{ openshift_openstack_public_dns_domain }}" osm_default_node_selector: 'region=primary' diff --git a/playbooks/openstack/sample-inventory/group_vars/all.yml b/playbooks/openstack/sample-inventory/group_vars/all.yml index 921edb867..ae1528123 100644 --- a/playbooks/openstack/sample-inventory/group_vars/all.yml +++ b/playbooks/openstack/sample-inventory/group_vars/all.yml @@ -10,7 +10,6 @@ openshift_openstack_dns_nameservers: [] #openshift_openstack_node_hostname: "app-node" #openshift_openstack_lb_hostname: "lb" #openshift_openstack_etcd_hostname: "etcd" -#openshift_openstack_dns_hostname: "dns" openshift_openstack_keypair_name: "openshift" openshift_openstack_external_network_name: "public" @@ -34,7 +33,6 @@ openshift_openstack_external_network_name: "public" #openshift_openstack_node_image_name: "centos7" #openshift_openstack_lb_image_name: "centos7" #openshift_openstack_etcd_image_name: "centos7" -#openshift_openstack_dns_image_name: "centos7" openshift_openstack_default_image_name: "centos7" openshift_openstack_num_masters: 1 @@ -49,7 +47,6 @@ openshift_openstack_num_nodes: 2 #openshift_openstack_node_flavor: "m1.medium" #openshift_openstack_lb_flavor: "m1.medium" #openshift_openstack_etcd_flavor: "m1.medium" -#openshift_openstack_dns_flavor: "m1.medium" openshift_openstack_default_flavor: "m1.medium" # # Numerical index of nodes to remove @@ -62,7 +59,6 @@ openshift_openstack_default_flavor: "m1.medium" #openshift_openstack_docker_infra_volume_size: "15" #openshift_openstack_docker_node_volume_size: "15" #openshift_openstack_docker_etcd_volume_size: "2" -#openshift_openstack_docker_dns_volume_size: "1" #openshift_openstack_docker_lb_volume_size: "5" openshift_openstack_docker_volume_size: "15" @@ -110,7 +106,6 @@ openshift_openstack_subnet_prefix: "192.168.99" # # Roll-your-own DNS -#openshift_openstack_num_dns: 0 #openshift_openstack_external_nsupdate_keys: # public: # key_secret: 'SKqKNdpfk7llKxZ57bbxUnUDobaaJp9t8CjXLJPl+fRI5mPcSBuxTAyvJPa6Y9R7vUg9DwCy/6WTpgLNqnV4Hg==' @@ -121,10 +116,6 @@ openshift_openstack_subnet_prefix: "192.168.99" # key_algorithm: 'hmac-md5' # server: '192.168.1.2' -# # Customize DNS server security options -#named_public_recursion: 'no' -#named_private_recursion: 'yes' - # NOTE(shadower): Do not change this value. The Ansible user is currently # hardcoded to `openshift`. diff --git a/playbooks/openstack/sample-inventory/inventory.py b/playbooks/openstack/sample-inventory/inventory.py index 47c56d94d..6fa219f22 100755 --- a/playbooks/openstack/sample-inventory/inventory.py +++ b/playbooks/openstack/sample-inventory/inventory.py @@ -79,10 +79,18 @@ def build_inventory(): public_v4 = server.public_v4 or server.private_v4 if public_v4: - hostvars['public_v4'] = public_v4 + hostvars['public_v4'] = server.public_v4 + hostvars['openshift_public_ip'] = server.public_v4 # TODO(shadower): what about multiple networks? if server.private_v4: hostvars['private_v4'] = server.private_v4 + # NOTE(shadower): Yes, we set both hostname and IP to the private + # IP address for each node. OpenStack doesn't resolve nodes by + # name at all, so using a hostname here would require an internal + # DNS which would complicate the setup and potentially introduce + # performance issues. + hostvars['openshift_ip'] = server.private_v4 + hostvars['openshift_hostname'] = server.private_v4 node_labels = server.metadata.get('node_labels') if node_labels: -- cgit v1.2.3 From 847996632a0f631b95216e6708db04b2c04e1019 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Wed, 29 Nov 2017 14:34:22 +0100 Subject: Update the doc text --- playbooks/openstack/advanced-configuration.md | 10 +++++----- playbooks/openstack/sample-inventory/inventory.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'playbooks/openstack/sample-inventory') diff --git a/playbooks/openstack/advanced-configuration.md b/playbooks/openstack/advanced-configuration.md index 03f9c84cc..c0bdf5020 100644 --- a/playbooks/openstack/advanced-configuration.md +++ b/playbooks/openstack/advanced-configuration.md @@ -49,14 +49,14 @@ Otherwise, even if there are differences between the two versions, installation ### Configure DNS -OpenShift requires two DNS records to function fully. The first one poinst to +OpenShift requires two DNS records to function fully. The first one points to the master/load balancer and provides the UI/API access. The other one is a wildcard domain that resolves app route requests to the infra node. If you followed the default installation from the README section, there is no -DNS configured. We can add two entries to your `/etc/hosts` to do a quick -validation. A real deployment will however require a DNS server with the -following entries set. +DNS configured. You should add two entries to the `/etc/hosts` file on the +Ansible host (where you to do a quick validation. A real deployment will +however require a DNS server with the following entries set. First, run the `openstack server list` command and note the floating IP addresses of the *master* and *infra* nodes (we will use `10.40.128.130` for @@ -69,7 +69,7 @@ Then add the following entries to your `/etc/hosts`: 10.40.128.134 cakephp-mysql-example-test.apps.openshift.example.com ``` -I.e. point the cluster domain (as defined in the +This points the cluster domain (as defined in the `openshift_master_cluster_public_hostname` Ansible variable in `OSEv3`) to the master node and any routes for deployed apps to the infra node. diff --git a/playbooks/openstack/sample-inventory/inventory.py b/playbooks/openstack/sample-inventory/inventory.py index 6fa219f22..ad3fd936b 100755 --- a/playbooks/openstack/sample-inventory/inventory.py +++ b/playbooks/openstack/sample-inventory/inventory.py @@ -91,6 +91,7 @@ def build_inventory(): # performance issues. hostvars['openshift_ip'] = server.private_v4 hostvars['openshift_hostname'] = server.private_v4 + hostvars['openshift_public_hostname'] = server.name node_labels = server.metadata.get('node_labels') if node_labels: -- cgit v1.2.3