当前位置:网站首页>云计算赛项--2020年赛题基础部分[任务3]
云计算赛项--2020年赛题基础部分[任务3]
2022-04-23 06:32:00 【King_nul】
前言
已经过去将近两年了,刚好最近封家里,闲了就把之前比赛的题做了一下,边学边做,再不动动手,就快把这些之前学过的东西都忘了。
欢迎来我的博客
在做题之前,一定要将平台都搭建好没问题了之后再开始做,不然后面有问题的时候,解决起来很费时间的,前面的任务 就是将基础的环境搭建起来。
2020云计算赛项(国基版)题目地址
任务三 – Opensatck 运维任务
题目一:镜像管理
在openstack私有云平台上,使用/附件/私有云附件/下的cirros-0.3.4-x86_64-disk.img镜像,使用命令创建一个名为cirros的镜像。完成后提交控制节点的用户名、密码和IP地址到答题框。(考试环境会提供所需要的镜像等资料)
# 由于我这里没有准备 镜像 直接在线下载一个镜像,考试环境是不能在线下载的,练习的小伙伴可以先下载下来用
[root@controller opt]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# 如果报错 -bash: wget: command not found 就使用 yum -y install wget 安装一下 wget
[root@controller opt]# ls
centos cirros-0.4.0-x86_64-disk.img OpenStack
# source 一下 admin-openrc 文件
[root@controller opt]# source /etc/keystone/admin-openrc.sh
# 查看一下当前存在的镜像,避免镜像名冲突
[root@controller opt]# glance image-list
+--------------------------------------+------------+
| ID | Name |
+--------------------------------------+------------+
| 7d833e56-9e49-4f57-87e6-dddbc17db404 | CentOS7.5 |
| f7f95f8f-05ae-45b6-a468-2b2e4084ae36 | docker-1-c |
| 558c538d-c4c0-4077-81a8-49e3ebac1a89 | docker-2-c |
+--------------------------------------+------------+
# 上传镜像
[root@controller opt]# glance image-create --name cirros --disk-format=qcow2 --container-format=bare --visibility=public --file /opt/cirros-0.4.0-x86_64-disk.img
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2022-04-10T08:58:39Z |
| disk_format | qcow2 |
| id | d5ea70a0-581f-4cc5-9a4e-02fa06e91fe6 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | d27d72c12d3b46b89572df53a71e5d04 |
| protected | False |
| size | 12716032 |
| status | active |
| tags | [] |
| updated_at | 2022-04-10T08:58:39Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
## 选项解释
–-name NAME :指定镜像在openstack中显示的名称;
–-disk-format DISK_FORMAT :镜像格式;openstack支持的格式详情请看官方介绍;
–-container-format CONTAINER_FORMAT :图片的容器格式,可以是ami,ari,aki,ovf,bare默认是bare
–-owner TENANT_ID :那个租户可以使用此镜像
–-size SIZE :这个镜像的大小
–-min-disk DISK_GB :这个镜像启动最小需要的大小;
–-min-ram DISK_RAM :启动这个镜像需要的最小内存;
–-location IMAGE_URL :在web界面中可以使用url地址上传镜像,目前支持http协议的;
–-file FILE :镜像所在本地目录;
–-checksum CHECKSUM :镜像数据验证;
–-is-public [True|False] :是否共享此镜像;共享后其他用户也可以使用此镜像启动instance;
[root@controller opt]# glance image-list
+--------------------------------------+------------+
| ID | Name |
+--------------------------------------+------------+
| 7d833e56-9e49-4f57-87e6-dddbc17db404 | CentOS7.5 |
| d5ea70a0-581f-4cc5-9a4e-02fa06e91fe6 | cirros |
| f7f95f8f-05ae-45b6-a468-2b2e4084ae36 | docker-1-c |
| 558c538d-c4c0-4077-81a8-49e3ebac1a89 | docker-2-c |
+--------------------------------------+------------+
在云平台中查看 是否已经上传好了镜像。

题目二:heat 模板管理
在openstack私有云平台上,在/root目录下编写模板server.yaml,创建名为“m1.flavor”、 ID 为 1234、内存为1024MB、硬盘为20GB、vcpu数量为 1的云主机类型。完成后提交控制节点的用户名、密码和IP地址到答题框。(在提交信息前请准备好yaml模板执行的环境)
heat 是Openstack中的一个自动化编排组件,用于批量创建资源和网络,也可以构建资源之间的关联性。
基本概念:
– 堆栈(stack):管理资源的集合。单个模板中定义的实例化资源的集合,是 Heat 管理应用程序的逻辑单元,往往对应一个应用程序。
– 模板(template):如何使用代码定义和描述堆栈。描述了所有组件资源以及组件资源之间的关系,是 Heat 的核心。
– 资源(resource):将在编排期间创建或修改的对象。资源可以是网络、路由器、子网、实例、卷、浮动IP、安全组等。
– 参数(parameters):heat模板中的顶级key,定义在创建或更新 stack 时可以传递哪些数据来定制模板。
– 参数组(parameter_groups):用于指定如何对输入参数进行分组,以及提供参数的顺序。
– 输出(outputs):heat模板中的顶级key,定义实例化后 stack 将返回的数据。
# 在 controller节点安装 heat 服务
[root@controller opt]# iaas-install-heat.sh
# 查看资源类型
[root@controller opt]# heat resource-type-list
WARNING (shell) "heat resource-type-list" is deprecated, please use "openstack orchestration resource type list" instead # 这里是警告 让使用 openstack orchestration resource type list 这个命令,不影响后续
+------------------------------------------+
| resource_type |
+------------------------------------------+
| AWS::AutoScaling::AutoScalingGroup |
|... |
| OS::Cinder::EncryptedVolumeType |
| OS::Cinder::QoSAssociation |
| OS::Cinder::QoSSpecs |
| OS::Cinder::Quota |
| OS::Cinder::Volume |
| OS::Cinder::VolumeAttachment |
| OS::Cinder::VolumeType |
| OS::Glance::Image |
| OS::Heat::AccessPolicy |
| OS::Heat::AutoScalingGroup |
| OS::Heat::CloudConfig |
| OS::Heat::DeployedServer |
| OS::Heat::InstanceGroup |
| OS::Heat::MultipartMime |
| OS::Heat::None |
| OS::Heat::RandomString |
| OS::Heat::ResourceChain |
| OS::Heat::ResourceGroup |
| OS::Heat::ScalingPolicy |
| OS::Heat::SoftwareComponent |
| OS::Heat::SoftwareConfig |
| OS::Heat::SoftwareDeployment |
| OS::Heat::SoftwareDeploymentGroup |
| OS::Heat::Stack |
| OS::Heat::StructuredConfig |
| OS::Heat::StructuredDeployment |
| OS::Heat::StructuredDeploymentGroup |
| OS::Heat::TestResource |
| OS::Heat::UpdateWaitConditionHandle |
| OS::Heat::Value |
| OS::Heat::WaitCondition |
| OS::Heat::WaitConditionHandle |
| OS::Keystone::Domain |
| OS::Keystone::Endpoint |
| OS::Keystone::Group |
| OS::Keystone::GroupRoleAssignment |
| OS::Keystone::Project |
| OS::Keystone::Region |
| OS::Keystone::Role |
| OS::Keystone::Service |
| OS::Keystone::User |
| OS::Keystone::UserRoleAssignment |
| OS::Neutron::AddressScope |
| OS::Neutron::ExtraRoute |
| OS::Neutron::FloatingIP |
| OS::Neutron::FloatingIPAssociation |
| OS::Neutron::FlowClassifier |
| OS::Neutron::MeteringLabel |
| OS::Neutron::MeteringRule |
| OS::Neutron::Net |
| OS::Neutron::NetworkGateway |
| OS::Neutron::Port |
| OS::Neutron::PortPair |
| OS::Neutron::ProviderNet |
| OS::Neutron::Quota |
| OS::Neutron::RBACPolicy |
| OS::Neutron::Router |
| OS::Neutron::RouterInterface |
| OS::Neutron::SecurityGroup |
| OS::Neutron::SecurityGroupRule |
| OS::Neutron::Subnet |
| OS::Neutron::SubnetPool |
| OS::Nova::Flavor |
| OS::Nova::FloatingIP |
| OS::Nova::FloatingIPAssociation |
| OS::Nova::HostAggregate |
| OS::Nova::KeyPair |
| OS::Nova::Quota |
| OS::Nova::Server |
| OS::Nova::ServerGroup |
| OS::Senlin::Cluster |
| OS::Senlin::Node |
| OS::Senlin::Policy |
| OS::Senlin::Profile |
| OS::Senlin::Receiver |
+------------------------------------------+
# 查看可用于编排的模板版本
[root@controller opt]# openstack orchestration template version list
+--------------------------------------+------+------------------------------+
| Version | Type | Aliases |
+--------------------------------------+------+------------------------------+
| AWSTemplateFormatVersion.2010-09-09 | cfn | |
| HeatTemplateFormatVersion.2012-12-12 | cfn | |
| heat_template_version.2013-05-23 | hot | |
| heat_template_version.2014-10-16 | hot | |
| heat_template_version.2015-04-30 | hot | |
| heat_template_version.2015-10-15 | hot | |
| heat_template_version.2016-04-08 | hot | |
| heat_template_version.2016-10-14 | hot | heat_template_version.newton |
| heat_template_version.2017-02-24 | hot | heat_template_version.ocata |
| heat_template_version.2017-09-01 | hot | heat_template_version.pike |
| heat_template_version.2018-03-02 | hot | heat_template_version.queens |
+--------------------------------------+------+------------------------------+
# 在/root/下编写 server.yaml 文件
[root@controller ~]# vim server.yaml
# server.yaml 文件内容
[root@controller ~]# cat server.yaml
heat_template_version: 2015-04-30 # 使用的heat模板版本
description: Create Flavor # 描述信息
resources: # 定义资源
flavor: # 在模板的资源部分中必须是唯一的资源ID
type: OS::Nova::Flavor # 资源类型,这里表示一个 Flavor 类型
properties: # 资源特定属性的列表。
name: "m1.flavor" # Flavor类型的名称属性
flavorid: "1234" # id属性,如果没有指定则会自动生成UUID
disk: 20 # 磁盘大小默认是GB
ram: 1024 # 内存大小必须是MB
vcpus: 1
outputs: # 定义输出信息
flavor_info: # 输出信息的名称
description: Get the information of virtual machine type # 输出描述
value: {
get_attr: [ flavor, show ] } # get_attr 从相应资源定义创建的实例在运行时解析其属性值进行输出
# 创建资源栈
[root@controller ~]# heat stack-create m1_flavor_stack -f server.yaml
WARNING (shell) "heat stack-create" is deprecated, please use "openstack stack create" instead
WARNING (shell) "heat stack-list" is deprecated, please use "openstack stack list" instead
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
| id | stack_name | stack_status | creation_time | updated_time | project |
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
| cb5d6ca6-9106-46f3-aa7d-8f85f0a86461 | m1_flavor_stack | CREATE_IN_PROGRESS | 2022-04-10T09:50:46Z | None | d27d72c12d3b46b89572df53a71e5d04 |
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
# 查看资源栈列表
[root@controller ~]# openstack stack list
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
| ID | Stack Name | Project | Stack Status | Creation Time | Updated Time |
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
| 5a4b1816-aaf6-4739-83e5-4001c80d89d1 | m1_flavor_stack | d27d72c12d3b46b89572df53a71e5d04 | CREATE_COMPLETE | 2022-04-10T10:31:32Z | None |
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
## Stack Status 显示 CREATE_COMPLETE 表示创建成功
# 查看指定栈的详细信息
[root@controller ~]# openstack stack show m1_flavor_stack
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
| id | 5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| stack_name | m1_flavor_stack |
| description | Create Flavor |
| creation_time | 2022-04-10T10:31:32Z |
| updated_time | None |
| stack_status | CREATE_COMPLETE |
| stack_status_reason | Stack CREATE completed successfully |
| parameters | OS::project_id: d27d72c12d3b46b89572df53a71e5d04 |
| | OS::stack_id: 5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| | OS::stack_name: m1_flavor_stack |
| | |
| outputs | - description: Get the information of virtual machine type |
| | output_key: flavor_info |
| | output_value: |
| | OS-FLV-DISABLED:disabled: false |
| | OS-FLV-EXT-DATA:ephemeral: 0 |
| | disk: 20 |
| | id: '1234' |
| | links: |
| | - href: http://controller:8774/v2.1/flavors/1234 |
| | rel: self |
| | - href: http://controller:8774/flavors/1234 |
| | rel: bookmark |
| | name: m1.flavor |
| | os-flavor-access:is_public: true |
| | ram: 1024 |
| | rxtx_factor: 1.0 |
| | swap: '' |
| | vcpus: 1 |
| | |
| links | - href: http://controller:8004/v1/d27d72c12d3b46b89572df53a71e5d04/stacks/m1_flavor_stack/5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| | rel: self |
| | |
| parent | None |
| disable_rollback | True |
| deletion_time | None |
| stack_user_project_id | 374ce98267964767adacf91527ac0412 |
| capabilities | [] |
| notification_topics | [] |
| stack_owner | None |
| timeout_mins | None |
| tags | None |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
在 dashborad 平台查看资源模板版本

查看我们创建的资源栈

在 云主机类型 中查看创建资源栈创建出来的云主机

题目三:swift分片存储
使用openstack私有云平台,自行安装Swift服务,新建名为chinaskill的容器,将cirros-0.3.4-x86_64-disk.img镜像上传到chinaskill容器中,并设置分段存放,每一段大小为10M。完成后提交控制节点的用户名、密码和IP地址到答题框。
先检查一下是否安装好了 swift 服务,如果还没安装,就执行命令安装
# 安装 swift 服务(双节点执行)
[root@controller ~]# iaas-install-swift-controller.sh
[root@compute ~]# iaas-install-swift-compute.sh
# 查看版本
[root@controller ~]# swift --version
python-swiftclient 3.5.0
[root@compute ~]# swift --version
python-swiftclient 3.5.0
# 创建一个名为 chinaskill 的容器
[root@controller ~]# swift post chinaskill # 创建容器 post 后面跟上容器名
[root@controller ~]# swift list # 查看容器列表
chinaskill
# 查看容器里面的内容(由于容器里面暂时还没有文件所以查看也是空的)
[root@controller ~]# swift list chinaskill
# 查看容器的详细信息
[root@controller ~]# swift list chinaskill
[root@controller ~]# swift stat
Account: AUTH_d27d72c12d3b46b89572df53a71e5d04
Containers: 1
Objects: 0
Bytes: 0
Containers in policy "policy-0": 1
Objects in policy "policy-0": 0
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: a5bce2bbc5394decb87c5cb1a6de952d
X-Openstack-Request-Id: tx91e5c3f27cb64082b5de6-006252b7e2
X-Timestamp: 1649587584.78538
X-Trans-Id: tx91e5c3f27cb64082b5de6-006252b7e2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
# 将镜像(我这里使用的是0.4.0版本的镜像)分片,每片为10M([字节在线转换](https://calc.itzmx.com/))
[root@controller opt]# swift upload chinaskill -S 10485760 cirros-0.4.0-x86_64-disk.img
cirros-0.4.0-x86_64-disk.img segment 1
cirros-0.4.0-x86_64-disk.img segment 0
cirros-0.4.0-x86_64-disk.img
# 查看分片文件的信息
[root@controller opt]# swift stat chinaskill cirros-0.4.0-x86_64-disk.img
Account: AUTH_d27d72c12d3b46b89572df53a71e5d04
Container: chinaskill
Object: cirros-0.4.0-x86_64-disk.img
Content Type: application/octet-stream
Content Length: 12716032
Last Modified: Sun, 10 Apr 2022 13:50:51 GMT
ETag: "7945d1b1d6ad1394eb6e2477f6a25fd3"
Manifest: chinaskill_segments/cirros-0.4.0-x86_64-disk.img/1649580724.978164/12716032/10485760/
Meta Mtime: 1649580724.978164
Accept-Ranges: bytes
X-Timestamp: 1649598650.12549
X-Trans-Id: txba9c525b8ea84110b59e2-006252e0d6
X-Openstack-Request-Id: txba9c525b8ea84110b59e2-006252e0d6
web界面查看容器和分片的文件

任务三 这样就完成了。
版权声明
本文为[King_nul]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_45925514/article/details/124135889
边栏推荐
- CTF-MISC学习之从开始到放弃
- sentinel集成nacos动态更新数据原理
- 国基北盛-openstack-容器云-环境搭建
- 从零开始完整学习机器学习和深度学习,包括理论和代码实现,主要用到scikit和MXNet,还有一些实践(kaggle上的)
- CTF攻防世界刷题51-
- Suggestions on university learning route planning
- SAP tr manual import system operation manual
- Intranet penetration series: icmpsh of Intranet tunnel
- Dictionary & lt; T1,T2> Sorting problem
- 《内网安全攻防:渗透测试实战指南》读书笔记(四):权限提升分析及防御
猜你喜欢

Buctf MISC brossage

【Unity VFX】VFX特效入门笔记-火花制作

STO With Billing 跨公司库存转储退货

内网渗透系列:内网隧道之icmptunnel(jamesbarlow师傅的)

Unity C# 单例模式 学习复习笔记

Shapley Explanation Networks

Houdini>建筑道路可变,学习过程笔记

When using flash, the code ends automatically without an error, the connection cannot be maintained, and the URL cannot be accessed.

SAP GUI security

Simplify exporting to SVG data files and all images in SVG folder
随机推荐
C#控制相机,旋转,拖拽观察脚本(类似Scenes观察方式)
Reading notes
Unity C single case mode learning review notes
庄懂的TA笔记(六)<FakeEnvReflect && 生锈,锈迹效果>
Intranet security attack and defense: a practical guide to penetration testing (6): domain controller security
What's new in. Net 5 NET 5
Houdini>刚体, 刚体破碎RBD
SAP self created table log function is enabled
C read INI file and write data to INI file
每天工作4小时的程序员
Buuctf misc brush questions
第四章 无形资产
About USB flash drive data prompt raw, need to format, data recovery notes
Attack and defense world misc questions 1-50
Talk about the essence of interface idempotent and consumption idempotent
Redis--为什么字符串emstr的字符串长度是44字节上限?
C smoothprogressbar custom progress bar control
Essays (updated from time to time)
C # control the camera, rotate and drag the observation script (similar to scenes observation mode)
《内网安全攻防:渗透测试实战指南》读书笔记(七):跨域攻击分析及防御