热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

优化后的标题:部署与配置Rancher操作系统指南

RancherOS是由RancherLabs开发的一款专为Docker设计的轻量级Linux发行版,提供了一个全面的Docker运行环境。其引导镜像仅20MB,非常适合在资源受限的环境中部署。本文将详细介绍如何在ESXi虚拟化平台上安装和配置RancherOS,帮助用户快速搭建高效、稳定的容器化应用环境。

RancherOS是由Rancher labs出品的一个专为Docker而生的精简版Linux,提供了一个完整的Docker运行环境。引导镜像仅有20MB大小,将其安装到ESXi虚拟机上导出之后,ova文件仅为300MB,比其他Linux发行版小的多。在我的工作环境中,需要将其安装至ESXi server,并向其他人分发。如果你有同样的需求,这篇文章也许可以或多或少帮助到你。英文文章,语法错误在所难免,欢迎批评指正。

To install RancherOS on your ESXi server, first of all, download rancheros ISO image from its website here

1. Create new Virtual Machine for RancherOS

On ESXi, create a new Virtual Machine with at least 1GB memory. After you created appliance, upload rancheros.iso to your ESXi datastore and set CD/DVD rom to use it.

2. Start rancheros

Once you clicked start button, the OS will boot up rapidly and prompt for login. Now rancheros is running in your RAM, you can login with credential rancher/rancher. Anything you change now will not be saved after you reboot. What we need is a docker ready OS so we need to install Rancher OS to our disk.

3. Prepare your cloud-config.yml

Before we install rancheros to our hard disk, you need to setup cloud-config first.

You also need to generate a new SSH key for cloud-config.yml file by following this article

Add your public key to cloud-config.yml file like following:

#cloud-config
ssh_authorized_keys:
- ssh-rsa #AB3NzaC1yc2E....Drinkey@JunkaitekiMacBook-Pro.local

This is for rancher os first boot configuration after installation, you can use your private key to connect this host.

Next, we are going to configure network before installation. Following is an example, you need to configure DNS, IP address of interface and default gateway.

rancher:
network:
dns:
nameservers:
- 172.23.0.5
- 119.6.6.6
interfaces:
eth*:
dhcp: false
eth0:
address: 10.138.103.63/24
gateway: 10.138.103.254
mtu: 1500

Make sure you only have one ethernet interface, current rancher os installer has problem when configuring multiple NICs.

Following is a complete example of cloud-config.yml.

#cloud-config
ssh_authorized_keys:
- ssh-rsa #AB3NzaC1yc2E....Drinkey@JunkaitekiMacBook-Pro.local
hostname: rancheros-cd01
rancher:
network:
dns:
nameservers:
- 119.6.6.6
interfaces:
eth*:
dhcp: false
eth0:
address: 10.138.103.63/24
gateway: 10.138.103.254
mtu: 1500

At last, you need to put your cloud-config.yml to rancher os. After you login, configure a accessible temporary IP address and default gateway on eth0, then scp your cloud-config.yml to it.

Following is an example

On RancherOS, configure IP and default gateway

$ sudo ip addr add 10.138.103.63/24 dev eth0
$ sudo route add default gw 10.138.103.254

On your local machine, copy your cloud-config.yml to RancherOS via SCP or other method.

4. Install

You should be all set if you done everything right in previous steps. Now we can call installer to initiate installation.

$ sudo rancheros-install -c cloud-config.yml -d /dev/sda

Installer will download rancher/os to your system and format /dev/sda. It could be some errors during installation, due to China GFW, keep retrying and you will success eventually.

At last, installer will prompt for reboot, after manual reboot you can configure own rancher os now.

5. Configuration

When rancher os came back, login interface would prompt several interface ip addresses. Now the old login credential rancher/rancher is not valid anymore, you can only use ssh with your private key to login

$ ssh -i wgid_rsa rancher@10.138.103.63

SSH will log you in directly without prompting for password. The private key should stay in your machine if this key-pair is not only for RancherOS connection. You can genenrate another key pair only for RancherOS first connection and you should distribute private key to other users. To enable multiple login, you need to enable ubuntu-console and configure password for user rancher

[rancher@rancheros-cd01 ~]$ sudo ros service list
disabled debian-console
disabled ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo ros service enable ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo ros service list
disabled debian-console
enabled ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo reboot

After reboot, setup new password for user rancher, then you should be able to login from anywhere if you have correct username and password.

Now a lightweight docker ready system is deployed on your ESXi machine.

You can login with account rancher/password. If it didn’t work, you can share the newly generated ssh key pair to your users, it will cause no security issue, because the key pair is only for connecting exported RancherOS. After first login, user can replace his/her own public SSH key in RancherOS authorized_keys file.

Rancher OS also privoded configuration and upgrade approaches and will be described in another document.


推荐阅读
  • 采用IKE方式建立IPsec安全隧道
    一、【组网和实验环境】按如上的接口ip先作配置,再作ipsec的相关配置,配置文本见文章最后本文实验采用的交换机是H3C模拟器,下载地址如 ... [详细]
  • 在维护公司项目时,发现按下手机的某个物理按键后会激活相应的服务,并在屏幕上模拟点击特定坐标点。本文详细介绍了如何使用ADB Shell Input命令来模拟各种输入事件,包括滑动、按键和点击等。 ... [详细]
  • 优化局域网SSH连接延迟问题的解决方案
    本文介绍了解决局域网内SSH连接到服务器时出现长时间等待问题的方法。通过调整配置和优化网络设置,可以显著缩短SSH连接的时间。 ... [详细]
  • 在 Android 开发中,通过 Intent 启动 Activity 或 Service 时,可以使用 putExtra 方法传递数据。接收方可以通过 getIntent().getExtras() 获取这些数据。本文将介绍如何使用 RoboGuice 框架简化这一过程,特别是 @InjectExtra 注解的使用。 ... [详细]
  • CSS高级技巧:动态高亮当前页面导航
    本文介绍了如何使用CSS实现网站导航栏中当前页面的高亮显示,提升用户体验。通过为每个页面的body元素添加特定ID,并结合导航项的类名,可以轻松实现这一功能。 ... [详细]
  • 当unique验证运到图片上传时
    2019独角兽企业重金招聘Python工程师标准model:public$imageFile;publicfunctionrules(){return[[[na ... [详细]
  • 本文详细介绍了如何在BackTrack 5中配置和启动SSH服务,确保其正常运行,并通过Windows系统成功连接。涵盖了必要的密钥生成步骤及常见问题解决方法。 ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • Scala 实现 UTF-8 编码属性文件读取与克隆
    本文介绍如何使用 Scala 以 UTF-8 编码方式读取属性文件,并实现属性文件的克隆功能。通过这种方式,可以确保配置文件在多线程环境下的一致性和高效性。 ... [详细]
  • dotnet 通过 Elmish.WPF 使用 F# 编写 WPF 应用
    本文来安利大家一个有趣而且强大的库,通过F#和C#混合编程编写WPF应用,可以在WPF中使用到F#强大的数据处理能力在GitHub上完全开源Elmis ... [详细]
  • 本文将深入探讨如何在不依赖第三方库的情况下,使用 React 处理表单输入和验证。我们将介绍一种高效且灵活的方法,涵盖表单提交、输入验证及错误处理等关键功能。 ... [详细]
  • Coursera ML 机器学习
    2019独角兽企业重金招聘Python工程师标准线性回归算法计算过程CostFunction梯度下降算法多变量回归![选择特征](https:static.oschina.n ... [详细]
  • YB02 防水车载GPS追踪器
    YB02防水车载GPS追踪器由Yuebiz科技有限公司设计生产,适用于车辆防盗、车队管理和实时追踪等多种场合。 ... [详细]
  • 本指南详细介绍了如何在同一台计算机上配置多个GitHub账户,并使用不同的SSH密钥进行身份验证,确保每个账户的安全性和独立性。 ... [详细]
  • 本文探讨如何利用Java反射技术来模拟Webwork框架中的URL解析过程。通过这一实践,读者可以更好地理解Webwork及其后续版本Struts2的工作原理,尤其是它们在MVC架构下的角色。 ... [详细]
author-avatar
手机用户2502853847
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有