Version 9 (modified by carlos, 6 years ago) (diff) |
---|
EGI FedCloud BIFI
Para el uso de recursos de computación cloud en BIFI EGI utilizaremos la imagen EGI Ubuntu 14.04. Para ello debemos configurar una serie de variables: ENDPOINT, OS_TPL, RES_TPL. Estas variables se pueden obtener bien desde el apartado Availability & Usage de la aplicación indicada o con siguientes comandos:
- Obtenemos la lista de sites disponibles en EGi FedCloud?:
[user@ui ~]$ ldapsearch -x -H ldap://lcg-bdii.cern.ch:2170 -b GLUE2GroupID=grid,o=glue "GLUE2ServiceType=IaaS" | grep GLUE2ServiceAdminDomainForeignKey | awk '{print $2}' CESGA NCG-INGRID-PT MK-04-FINKICLOUD CESNET-MetaCloud BIFI BIFI INFN-PADOVA-STACK FZJ CETA-GRID IFCA-LCG2 IISAS-GPUCloud UPV-GRyCAP IISAS-FedCloud JINR-LCG2 RECAS-BARI INDIGO-CATANIA-STACK INFN-CATANIA-NEBULA INFN-CATANIA-STACK IN2P3-IRES UA-BITP HG-09-Okeanos-Cloud SCAI CYFRONET-CLOUD 100IT
- Obtenemos la variable ENDPOINT :
[user@ui ~]$ ldapsearch -x -H ldap://lcg-bdii.cern.ch:2170 -b GLUE2DomainID=BIFI,GLUE2GroupID=grid,o=glue GLUE2EndpointInterfaceName=OCCI | grep GLUE2EndpointURL | awk {'print $2'} http://server4-epsh.unizar.es:8787 http://server4-eupt.unizar.es:8787
- Generamos un proxy válido para poder operar en la infraestructura EGI FedCloud :
[user@ui ~]$ voms-proxy-init -voms fedcloud.egi.eu --rfc Enter GRID pass phrase for this identity: Contacting voms2.grid.cesnet.cz:15002 [/DC=org/DC=terena/DC=tcs/C=CZ/ST=Hlavni mesto Praha/L=Praha 6/O=CESNET/CN=voms2.grid.cesnet.cz] "fedcloud.egi.eu"... Remote VOMS server contacted succesfully. Created proxy in /tmp/x509up_u15139. Your proxy is valid until Wed May 04 22:59:34 CEST 2016
- Configuramos las variables de entorno ENDPOINT y X509_USER_PROXY :
[user@ui ~]$ export ENDPOINT=http://server4-epsh.unizar.es:8787 [user@ui ~]$ export X509_USER_PROXY=/tmp/x509up_u15139
- Obtenemos la lista de imágenes disponibles en el site:
[user@ui ~]$ occi --endpoint $ENDPOINT --action list --resource os_tpl --auth x509 --user-cred $X509_USER_PROXY --voms http://schemas.openstack.org/template/os#963b4980-b960-4030-91e1-1348d1c127da http://schemas.openstack.org/template/os#41088b49-9407-46a4-98e6-4f1cba844708 http://schemas.openstack.org/template/os#347d81ab-5f40-4790-a5d9-e24b1d8d93ff http://schemas.openstack.org/template/os#c4cf79d6-68b9-4e14-b794-05d6fce40567 http://schemas.openstack.org/template/os#a3718e1d-a93a-4bef-9256-090d5e2d7408 http://schemas.openstack.org/template/os#9aa3aba8-aff5-4f87-a2a0-7d9c7d31f973 http://schemas.openstack.org/template/os#85d71126-7f1f-4e53-9927-988786a9b78e http://schemas.openstack.org/template/os#37c0680c-44f8-44c3-9a6d-022629a5f125 http://schemas.openstack.org/template/os#db256cbf-b080-46a8-8542-02ef164c03e5 http://schemas.openstack.org/template/os#82070437-c4cf-4f54-a514-1368fc59e2ed http://schemas.openstack.org/template/os#8775dc9e-73e4-4639-9c51-70ee83bc5fbe http://schemas.openstack.org/template/os#52dfed57-9a4e-4f4d-b367-8fc9fc9c20b9 http://schemas.openstack.org/template/os#96f79427-3ab0-4f14-90f4-7a7086e8974e http://schemas.openstack.org/template/os#5d2ffced-437d-4bb1-8a09-8517f33687be http://schemas.openstack.org/template/os#d9480c35-8b6a-45f7-a611-b79fc2bf3b0d http://schemas.openstack.org/template/os#337b6584-e1b1-4b60-bfbe-512b03c70b0c http://schemas.openstack.org/template/os#3fe16db2-f503-485c-915c-033a2c095d48 http://schemas.openstack.org/template/os#3497cb55-99e2-49f3-8e0a-ea7847795384 http://schemas.openstack.org/template/os#fbad50eb-1d90-4c16-8877-7b0d76a11294 http://schemas.openstack.org/template/os#e0c39dc4-3adb-48b9-9b66-002c3b3bdc5c http://schemas.openstack.org/template/os#d4ac6777-135d-415a-b8d4-07d4b3db848d http://schemas.openstack.org/template/os#bab4d55b-9c51-4f38-a9bd-525b14e478ec http://schemas.openstack.org/template/os#59e5f4e3-67b4-42b4-9d76-e6c623d4d146 http://schemas.openstack.org/template/os#5f812ff2-54b5-4b71-bf80-8c73da78ae02 http://schemas.openstack.org/template/os#991c2aa6-e121-411b-b550-6b0c2bbc4b57 http://schemas.openstack.org/template/os#d0962fdb-abe2-43b8-a90e-881422ed9b1d http://schemas.openstack.org/template/os#9655590c-e1a7-4f43-b0c6-9e405c33324b http://schemas.openstack.org/template/os#9b637608-7c39-49d8-8cc1-995d63dc32f2 http://schemas.openstack.org/template/os#515f69f9-c809-42de-b9ce-8a6160b5d133 http://schemas.openstack.org/template/os#bd58e06d-76ed-4b13-a6af-5e58dfe4bf00
- Obtenemos lista de flavours disponibles en el site :
[user@ui ~]$ occi --endpoint $ENDPOINT --action list --resource resource_tpl --auth x509 --user-cred $X509_USER_PROXY --voms http://schemas.openstack.org/template/resource#m1-haproxy http://schemas.openstack.org/template/resource#m1-large_noephemeral http://schemas.openstack.org/template/resource#m1-tiny_ephemeral http://schemas.openstack.org/template/resource#m1-small_cern http://schemas.openstack.org/template/resource#m1-xlarge http://schemas.openstack.org/template/resource#m1-medium http://schemas.openstack.org/template/resource#hadoop_fedcloud_ephemeral http://schemas.openstack.org/template/resource#m1-tiny http://schemas.openstack.org/template/resource#m1-small http://schemas.openstack.org/template/resource#m1-xlarge_cloudflow http://schemas.openstack.org/template/resource#m1-large http://schemas.openstack.org/template/resource#m1-schnell http://schemas.openstack.org/template/resource#m1-inycom http://schemas.openstack.org/template/resource#pruebasraid http://schemas.openstack.org/template/resource#m1-cloudflow http://schemas.openstack.org/template/resource#m1-small-ephemeral
- Configuramos la imagen del Ubuntu 14.04 y seleccionamos un flavour para esa imagen :
[user@ui ~]$ export OS_TPL=http://schemas.openstack.org/template/os#b14b85ee-782b-43bf-8616-6bf2f1665949 [user@ui ~]$ export RES_TPL=http://schemas.openstack.org/template/resource#m1-small
Una vez configuradas la variables de entorno podemos crear, monitorizar y destruir nuestra VM :
- Creamos un par clave publica-privada para conectarnos a las maquinas virtuales (VM) que creemos :
[user@ui ~]$ ssh-keygen -t rsa -b 2048 -f tmpfedcloud
- Configuramos la VM utilizado cloud config:
[user@ui ~]$ cat > tmpfedcloud.login << EOF #cloud-config users: - name: cloudadm shell: /bin/bash sudo: ALL=(ALL) NOPASSWD:ALL lock-passwd: true ssh-import-id: cloudadm ssh-authorized-keys: - `cat tmpfedcloud.pub` EOF
- Creamos la VM :
[user@ui ~]$ VM_ID=$(occi --endpoint $ENDPOINT --auth x509 --user-cred $X509_USER_PROXY --voms --action create --resource compute --attribute occi.core.title="MyFirstVM" --mixin $OS_TPL --mixin $RES_TPL --context user_data="file://$PWD/tmpfedcloud.login")
- Obtenemos información de sus características, como su dirección IP:
[user@ui ~]$ occi --endpoint $ENDPOINT --auth x509 --user-cred $X509_USER_PROXY --voms --action describe --resource ${VM_ID} ######################################################################################################################################################################################### [[ http://schemas.ogf.org/occi/infrastructure#compute ]] >> location: /compute/1341dce4-8dd5-412c-a2b8-14466dc0ebf4 occi.core.id = 1341dce4-8dd5-412c-a2b8-14466dc0ebf4 occi.compute.architecture = x86 occi.compute.cores = 1 occi.compute.hostname = myfirstvm occi.compute.memory = 2.0 occi.compute.speed = 0.0 occi.compute.state = inactive org.openstack.compute.console.vnc = N/A org.openstack.compute.state = building Links: [[ http://schemas.ogf.org/occi/infrastructure#networkinterface ]] >> location: /network/interface/1341dce4-8dd5-412c-a2b8-14466dc0ebf4_172.35.0.20 occi.networkinterface.gateway = 172.35.0.1 occi.networkinterface.mac = fa:16:3e:d5:60:0e occi.networkinterface.interface = eth0 occi.networkinterface.state = active occi.networkinterface.allocation = static occi.networkinterface.address = 172.35.0.20 occi.core.source = /compute/1341dce4-8dd5-412c-a2b8-14466dc0ebf4 occi.core.target = /network/admin occi.core.id = /network/interface/1341dce4-8dd5-412c-a2b8-14466dc0ebf4_172.35.0.20 Mixins: [[ http://schemas.openstack.org/compute/instance#os_vms ]] title: term: os_vms location: /os_vms/ [[ http://schemas.openstack.org/template/os#b14b85ee-782b-43bf-8616-6bf2f1665949 ]] title: Image: FEDCLOUD Image for EGI Ubuntu 14.04 [Ubuntu/14.04/VirtualBox] term: b14b85ee-782b-43bf-8616-6bf2f1665949 location: /b14b85ee-782b-43bf-8616-6bf2f1665949/
- Como la IP no es pública, es necesario ejecutar el siguiente comando :
[user@ui ~]$ occi --endpoint $ENDPOINT --auth x509 --user-cred $X509_USER_PROXY --voms --action link --resource ${VM_ID} --link /network/public http://server4-epsh.unizar.es:8787/network/interface/1341dce4-8dd5-412c-a2b8-14466dc0ebf4_155.210.198.164
- Nos conectamos a la VM por medio de ssh haciendo uso de la clave privada que hemos generado con anterioridad:
[user@ui ~]$ ssh -i tmpfedcloud cloudadm@155.210.198.164
- Finalmente una vez utilizada la VM la destruimos :
[user@ui ~]$ occi --endpoint $ENDPOINT --auth x509 --user-cred $X509_USER_PROXY --voms --action delete --resource ${VM_ID}