mi

使用xserver1虚拟机,使用VMWare软件自行添加一块大小为20G的硬盘,使用fdisk命令对该硬盘进形分区,要求分出两个大小为5G的分区。使用两个分区,创建名xcloudvg的卷组,然后再创建一个5G的分区,将xcloudvg扩容至15G,最后执行vgdisplay命令查看卷组信息。将上述所有操作命令和返回结果以文本形式提交到答题框。

参考答案

[root@xserver1 ~]# pvcreate /dev/sdb[1-2]

  Physical volume "/dev/sdb1" successfully created

  Physical volume "/dev/sdb2" successfully created

[root@xserver1 ~]# vgcreate xcloudvg /dev/sdb[1-2]

  Volume group "xcloudvg" successfully created

[root@xserver1 ~]# vgs

  VG       #PV #LV #SN Attr   VSize  VFree

  centos     1   2   0 wz--n- 39.51g 44.00m

  xcloudvg   2   0   0 wz--n-  9.99g  9.99g

[root@xserver1 ~]# vgextend xcloudvg /dev/sdb3

  Volume group "xcloudvg" successfully extended

[root@xserver1 ~]# vgs

  VG       #PV #LV #SN Attr   VSize  VFree

  centos     1   2   0 wz--n- 39.51g 44.00m

  xcloudvg   3   0   0 wz--n- 14.99g 14.99g

[root@xserver1 ~]# vgdisplay

  --- Volume group ---

  VG Name               xcloudvg

  System ID             

  Format                lvm2

  Metadata Areas        3

  Metadata Sequence No  2

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                3

  Act PV                3

  VG Size               14.99 GiB

  PE Size               4.00 MiB

  Total PE              3837

  Alloc PE / Size       0 / 0   

  Free  PE / Size       3837 / 14.99 GiB

  VG UUID               Bhe3rc-7CUf-CdDa-WXJZ-IPZk-BRWt-eLlACf

 

OpenStack Keystone管理

使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。在keystone中创建用户testuser,密码为123456,创建好之后,查看testuser的详细信息。将上述所有操作命令及返回结果以文本形式提交到答题框。

参考答案

[root@controller~]# source /etc/keystone/admin-openrc.sh

[root@controller~]# openstack user create --domain xiandian --password 123456 testuser

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | 3ac89594c8e944a9b5bb567fca4e75aa |

| enabled   | True                             |

| id        | fb1f3175d3ef4974a12c8482307c8e24 |

| name      | testuser                         |

+-----------+----------------------------------+

[root@controller~]# openstack user show testuser

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | 639e7d52170d4759b5438e3b29bbf339 |

| enabled   | True                             |

| id        | df8ca15f17a8435d8889987b4b78c7a2 |

| name      | testuser                         |

+-----------+----------------------------------+

 

OpenStack Glance管理

使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。在xserver1节点的/root目录下存在一个cirros-0.3.4-x86_64-disk.img镜像;使用glance命令将镜像上传,并命名为mycirros,最后将glance image-show id命令的返回结果以文本形式提交到答题框。

参考答案

[root@xiandian ~]# glance image-show d3663be2-3ebf-443a-b3fc-b3e39bda8783

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |

| container_format | bare                                 |

| created_at       | 2019-10-24T10:16:52Z                 |

| disk_format      | qcow2                                |

| id               | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | mycirros                             |

| owner            | 0ab2dbde4f754b699e22461426cd0774     |

| protected        | False                                |

| size             | 13287936                             |

| status           | active                               |

| tags             | []                                   |

| updated_at       | 2019-10-24T10:16:52Z                 |

| virtual_size     | None                                 |

| visibility       | private                              |

 

 

 

Docker安装

使用xserver1节点,自行配置YUM源,安装docker服务(需要用到的包为xserver1节点/root目录下的Docker.tar.gz)。安装完服务后,将registry_latest.tar上传到xserver1节点中并配置为私有仓库。要求启动registry容器时,将内部保存文件的目录映射到外部的/opt/registry目录,将内部的5000端口映射到外部5000端口。依次将启动registry容器的命令及返回结果、执行docker info命令的返回结果以文本形式提交到答题框。

参考答案

[root@master ~]# docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest

Containers: 33

 Running: 16

 Paused: 0

 Stopped: 17

Images: 22

Server Version: 18.09.6

Storage Driver: devicemapper

 Pool Name: docker-253:0-113162281-pool

 Pool Blocksize: 65.54kB

 Base Device Size: 10.74GB

 Backing Filesystem: xfs

 Udev Sync Supported: true

 Data file: /dev/loop0

 Metadata file: /dev/loop1

 Data loop file: /var/lib/docker/devicemapper/devicemapper/data

 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata

 Data Space Used: 3.573GB

 Data Space Total: 107.4GB

 Data Space Available: 18.72GB

 Metadata Space Used: 22.59MB

 Metadata Space Total: 2.147GB

 Metadata Space Available: 2.125GB

 Thin Pool Minimum Free Space: 10.74GB

 Deferred Removal Enabled: true

 Deferred Deletion Enabled: true

 Deferred Deleted Device Count: 0

 Library Version: 1.02.158-RHEL7 (2019-05-13)

Logging Driver: json-file

Cgroup Driver: cgroupfs

Plugins:

 Volume: local

 Network: bridge host macvlan null overlay

 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339

runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657

init version: fec3683

Security Options:

 seccomp

  Profile: default

Kernel Version: 3.10.0-1062.7.1.el7.x86_64

Operating System: CentOS Linux 7 (Core)

OSType: linux

Architecture: x86_64

CPUs: 2

Total Memory: 1.913GiB

Name: master

ID: U4ME:YWV6:WZEK:7R7W:5OLN:MO4A:NVNH:AEPR:L7GE:UD4S:UZOY:GZXQ

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

 192.168.70.10:5000

 127.0.0.0/8

Live Restore Enabled: false

Product License: Community Engine

WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release.

WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.

         Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.

 

Dockerfile编写

使用xserver1节点,新建目录centos-jdk,将提供的jdk-8u141-linux-x64.tar.gz复制新建的目录,然后编辑Dockerfile文件,文件要求如下:

1.使用centos:latest基础镜像;

2.指定作为为xiandian

3.新建文件夹/usr/local/java用于存放jdk文件;

4.JDK文件复制到镜像内创建的目录并自动解压;

5.创建软连接:ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk;

6.设置环境变量如下

ENV JAVA_HOME /usr/local/java/jdk

ENV JRE_HOME ${JAVA_HOME}/jre

ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib

ENV PATH ${JAVA_HOME}/bin:$PATH

编写完毕后,构建名为centos-jdk的镜像,构建成功后,查看镜像列表。最后将Dockerfile的内容、构建镜像的操作命令、查看镜像列表的命令和返回的结果以文本形式提交到答题框。

参考答案

[root@master centos-jdk]# cat Dockerfile

# CentOS with JDK 8

# Author   Guo

# 指定基础镜像

FROM centos

# 指定作者

MAINTAINER Guo

# 新建文件夹用于存放jdk文件

RUN mkdir /usr/local/java

# JDK文件复制到镜像内并自动解压

ADD jdk-8u141-linux-x64.tar.gz /usr/local/java/

# 创建软链接

RUN ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk

# 设置环境变量

ENV JAVA_HOME /usr/local/java/jdk

ENV JRE_HOME ${JAVA_HOME}/jre

ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib

ENV PATH ${JAVA_HOME}/bin:$PATH

[root@master centos-jdk]# docker build -t="centos-jdk" .

Sending build context to Docker daemon  185.5MB

Step 1/9 : FROM centos

... ...

Step 9/9 : ENV PATH ${JAVA_HOME}/bin:$PATH

 ---> Running in 7affe7505c82

Removing intermediate container 7affe7505c82

 ---> bdf402785277

Successfully built bdf402785277

Successfully tagged centos-jdk:latest

[root@master centos-jdk]# docker images

REPOSITORY     TAG         IMAGE ID      CREATED       SIZE

centos-jdk         latest         bdf402785277   11 minutes ago    596MB

 

posted @ 2020-09-25 14:08  东北最后深情  阅读(1620)  评论(0编辑  收藏  举报