addon-metadata - Metadata server for OpenNebula
This addon is a metadata server, compatible with EC2, for the OpenNebula Cloud Toolkit. This allows any Openstack, Amazon AMIs or any cloud-init based image with OpenNebula, without any change. The images will be contextualized, and will process user-data with or without cloud-init. Also allows any script relying on Amazon Metadata to run inside OpenNebula, without change.
- Download CoreOS OpenStack image from the coreos site (https://stable.release.core-os.net/amd64-usr/current/coreos_production_openstack_image.img.bz2)
- Register coreos_production_openstack_image.img to OpenNebula
- Run the image with any user-data script supported by CoreOS
- The image will boot and be contextualized, without any change
To contribute bug patches or new features, you can use the github Pull Request model. It is assumed that code and documentation are contributed under the Apache License 2.0.
- How to Contribute
- Support: OpenNebula user mailing list
- Development: OpenNebula developers mailing list
- Issues Tracking: Github issues (https://github.com/OpenNebula/addon-metadata/issues)
- Ricardo Duarte (firstname.lastname@example.org)
This add-on is compatible with OpenNebula 3.8, 4.0, 4.2, 4.4, 4.12, 4.14. Tested extensively with 4.12 (EC2)
OpenNebula Server installation is required.
The installation script assumes OpenNebula is installed system-wide. To install, run the following script:
An init script is provided for Debian based distributions.
REDIRECT TO 169.254.169.254:80
To comply with EC2, the metadata server should be available from http://169.254.169.254:80. To enable this either:
- Setup a redirect rule on the default gateway
- Setup a redirect on each host, using iptables
REDIRECT ON DEFAULT GATEWAY
This is out of scope for this document
REDIRECT USING IPTABLES
The rp_filter must be disabled for each cloud interface/bridge. To do so, add a line to /etc/sysctl.conf for each interface:
net.ipv4.conf.<interface_name>.rp_filter = 0
If using bridges, the following line must also be added/modified:
net.bridge.bridge-nf-call-iptables = 1
On each host, run the following at startup (ex.: using rc.local):
iptables -t nat -A PREROUTING -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination <metadata_server_ip>:<metadata_server_port>
The metadata server was thought to work with instances launched by eucatools, hybridfox or econe-* , and assumes that you are using the standard /etc/one/ec2query_templates/*.erb . If a custom template is to be used, add the folowing context variables:
CONTEXT = [ (...) EC2_USER_DATA = <YOUR USER DATA> EC2_PUBLIC_KEY = <YOUR PUBLIC KEY> EC2_KEYNAME = <THE NAME OF THE KEY> ]
If there is the need to use other variables instead, just change them on /usr/lib/one/ruby/cloud/metadata/MetadataServer.rb. Search and replace with your own data:
TEMPLATE/CONTEXT/EC2_KEYNAME TEMPLATE/CONTEXT/EC2_PUBLIC_KEY TEMPLATE/CONTEXT/EC2_USER_DATA
To test the metadata server, download and run the EC2 Instance Metadata Query Tool tool from inside an instance. The EC2 Instance Metadata Query Tool tool is available
Ricardo Duarte (email@example.com)
Copyright 2017, Ricardo Duarte (firstname.lastname@example.org)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.