# Technical Documentation: labring/sealos

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/labring/sealos)

### Overview (README.md)

<div align="center">

  <a href="https://sealos.io" target="_blank" rel="noopener">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="./docs/img/sealos-left-dark.png" />
      <source media="(prefers-color-scheme: light)" srcset="./docs/img/sealos-left.png" />
      <img src="./docs/img/sealos-left.png" />
    </picture>
  </a>
  
# 🚀 Develop, deploy, and scale in one seamless cloud platform ☁️

Sealos['siːləs] is an AI-native Cloud Operating System built on Kubernetes that unifies the entire application lifecycle, from development in cloud IDEs to production deployment and management. It is perfect for building and scaling modern AI applications, SaaS platforms, managed databases (MySQL, PostgreSQL, Redis, MongoDB) and complex microservice architectures.

</div>

<div align="center">

[](https://vscode.dev/github/labring/sealos)
[](https://github.com/labring/sealos/actions)
[](https://hub.docker.com/r/labring/kubernetes)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Flabring%2Fsealos?ref=badge_shield)
[](https://codecov.io/gh/labring/sealos)
[](https://sealos.io)
[](https://www.oscs1024.com/repo/labring/sealos?ref=badge_small)

<a href="https://runacap.com/ross-index/annual-2023/" target="_blank" rel="noopener">
    <img
        style="width: 260px; height: 56px margin-top: 50px"
        src="https://runacap.com/wp-content/uploads/2024/03/Annual_ROSS_badge_black_2023.svg"
        alt="ROSS Index - Fastest Growing Open-Source Startups | Runa Capital"
        width="260"
        height="56"
    />
</a>

</div>

<hr />

<div align="center">
 <a href="https://sealos.io">Website</a> •
  <a href="https://sealos.io/docs">Docs</a> •
  <a href="https://discord.gg/wdUn538zVP">Discord</a> •
  <a href="https://twitter.com/Sealos_io">Twitter</a> •
  <a href="./README_zh.md">简体中文</a>
</div>

<br />

<div align="center">

[![Deploy on Sealos][deploy-badge]][deploy-link]

https://github.com/user-attachments/assets/cc8599da-6c3e-4503-bb53-55e13bf61ef6

<img width="916" alt="image" src="https://github.com/labring/sealos/assets/8912557/9e8c1d76-718e-4910-a9ab-94f220a61a9c">

</div>

## Get started

### Create your Development Environment in Sealos with just one click

1. Open Sealos Devbox.

 <img width="914" height="331" alt="image" src="https://github.com/user-attachments/assets/cbc2982b-d40a-458b-9c07-078bd9e36a3b" />

2. Create a development environment, choosing from a range of languages and frameworks.

 <img width="1147" alt="image" src="https://github.com/user-attachments/assets/6075bbb0-4765-4786-9154-3adaa139900c">

3. Access your environment from a selection of IDEs, such as VSCode and Cursor.

    <img width="864" alt="image" src="https://github.com/user-attachments/assets/e5f9dcdc-5149-4e43-aa13-6c17507fbe9f">

    <img width="1024" alt="image" src="https://github.com/user-attachments/assets/9a985280-6ff2-48dc-83b9-9abd8f93af17">

### Create your Database on Sealos

1. Open Sealos database.

 <img width="824" height="256" alt="image" src="https://github.com/user-attachments/assets/4f28b15f-c453-4110-93ae-ce0e72caea48" />

2. Create your database.

 <img width="874" alt="image" src="https://github.com/user-attachments/assets/4cc88a54-70e6-458f-9766-4578774e7f81">

3. View your database and access details.

 <img width="1430" alt="image" src="https://github.com/user-attachments/assets/bcf54218-f4f4-4c89-a107-0bbde6f92d67">

### Deploy your Docker Image on Sealos

1. Open Sealos App Launchpad.

 <img width="885" height="191" alt="image" src="https://github.com/user-attachments/assets/3134922a-75b4-4c3b-a3e4-6c402f171dff" />

2. Deploy the Docker image using a Kubernetes Deployment and expose it with an Ingress.

 <img width="971" alt="image" src="https://github.com/user-attachments/assets/a291571f-d9fe-42e5-812e-3d8f274a97ca">

3. View your app details and access your service.

 <img width="1016" alt="image" src="https://github.com/user-attachments/assets/a54884cf-a1e8-4178-88af-655234ec7eef">

## 💡 Core features

- Integrated Cloud IDEs: Zero-setup, collaborative development in the cloud. Eliminate local environment inconsistencies with DevBox.
- Managed Databases & Storage: Production-ready PostgreSQL, MySQL, MongoDB, Redis, and built-in S3-compatible Object Storage.
- Extensive App Store: Deploy complex applications with a single click. No YAML configuration, no container orchestration complexity - just point, click, and deploy.
- Full Kubernetes Power: Access the full power of Kubernetes without the complexity. K8s-native from day one.
- Enterprise Multi-Tenancy: Workspace-based isolation with granular RBAC and per-workspace resource quotas for secure collaboration.
- AI-Native Infrastructure: Build and scale anything with AI simply by describing them.

## 🏘️ Community & support

- 🌐 Visit the [Sealos Website](https://sealos.io/) for full documentation and useful links.
- 💬 Join our [Discord Server](https://discord.gg/wdUn538zVP) to chat with the Sealos team and other Sealos users. This is a good place to learn about Sealos and Kubernetes, ask questions, and share your experiences.
- 🐦 Tweet at @Sealos_io on [X/Twitter](https://twitter.com/Sealos_io) and follow us.
- 🐞 Create [GitHub Issues](https://github.com/labring/sealos/issues/new/choose) for bug reports and feature requests.

## 🚧 Roadmap

Sealos maintains a [public roadmap](https://github.com/orgs/labring/projects/4/views/9). It gives a high-level view of the main priorities for the project, the maturity of different features and projects, and how to influence the project direction.

## 👩‍💻 Contributing & Development

Have a look through [existing issues](https://github.com/labring/sealos/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and [Pull Requests](https://github.com/labring/sealos/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) that you could help with. If you'd like to request a feature or report a bug, please [create a GitHub Issue](https://github.com/labring/sealos/issues/new/choose) using one of the templates provided.

📖 [See contribution guide →](./CONTRIBUTING.md)

🔧 [See development guide →](./DEVELOPGUIDE.md)

## Links

- [FastGPT](https://github.com/labring/FastGPT) is a free, open-source, and powerful AI knowledge base platform, offers out-of-the-box data processing, model invocation, RAG retrieval, and visual AI workflows. Easily build complex LLM applications.
- [Buildah](https://github.com/containers/buildah) The functionalities of Buildah are extensively utilized in Sealos 4.0 to ensure that cluster images are compatible with OCI standard.

[deploy-badge]: https://sealos.io/Deploy-on-Sealos.svg
[deploy-link]: https://os.sealos.io

## 📄 License

Sealos is licensed under the [Sealos Sustainable Use License](./LICENSE.md), a custom license that allows:

- ✅ Internal business use and personal non-commercial use
- ❌ Providing cloud services to third parties

**Not a standard open source license** - please review the [full license terms](./LICENSE.md) before use.

**Contributing**: By contributing, you agree to our [Contributor License Agreement](./CONTRIBUTOR_LICENSE_AGREEMENT.md) and license change terms.

---

### README (`docs/README.md`)

# Documentation Migration

The documentation for Sealos has been moved to [https://github.com/labring/sealos.io/](https://github.com/labring/sealos.io/).

Please refer to the new location for the latest guides and references.

---

**Notice:**  
Documentation for previous versions (`3.0`, `4.0`, and `5.0`) has been archived and is no longer actively maintained in this repository.

---

### Archived 4.0 Docs Intro (`docs/archived/4.0/docs/Intro.md`)

import Highlight from '@site/src/components/Highlight'

# What is Sealos?

<Highlight content="Try Sealos now" url="https://cloud.sealos.io" />

The vastness and complexity of the cloud-native ecosystem undoubtedly leaves many businesses in disarray, yearning for an efficient, ready-to-use distribution, which this ecosystem sorely lacks. The cloud-native market is in dire need of a cloud operating system to further reduce barriers and costs.

The advent of Sealos opens a new window for enterprises. It provides a novel choice for businesses and developers alike, necessitating only the installation of a cloud operating system, regardless of public or private cloud use. It allows various applications to operate stably and securely, tackling all sorts of dependency issues they might require.

Sealos adheres to the philosophy that **cloud usage can be as simple as Linux**. You can commence usage right after installation, as you would with Linux, without entanglement in excessive complexities. The sole difference is that while Linux is installed on a single server, Sealos is installed across an entire data center.

In Sealos's architecture, **there's no essential difference between public and private clouds**. They should be separate instances of the same codebase, the only distinction lying in their configuration and installed applications. Installing it on an intranet renders it a private cloud, while offering services on the public internet converts it into a public cloud.

We firmly believe that with the continuous development and advancement of Sealos, the future of cloud computing will be more open, more straightforward. The benefits of cloud computing should belong to all providers of computational power, and the value of the cloud should be shared by all participants of cloud computing. **They will be able to enjoy the various conveniences of cloud computing in a more economical fashion in a diversified market environment.**

## Overview

Sealos is a **cloud operating system distribution** based on the Kubernetes kernel. It adopts a cloud-native approach, discarding traditional cloud computing architecture, and shifting towards a new architecture with Kubernetes as the cloud kernel. This allows enterprises to use the cloud **as effortlessly as they would use a personal computer**.

Users will be able to install any high-availability distributed application on Kubernetes with the click of a button, similar to using a personal computer. It practically requires no professional delivery or operational costs. Simultaneously, utilizing unique cluster imaging capabilities, users can package any distributed application into an OCI image, freely combine a variety of distributed applications, and easily customize their desired cloud. The powerful and flexible app store function can meet the diverse needs of various users.



## Scenarios & Advantages

Sealos is a powerful business operating platform, providing flawless support for various applications such as Java, Go, Python, PHP, and more, unrestricted by the programming language. The platform offers a stable operating environment for applications and resolves backend dependency issues like databases, object storage, and messaging queues. Further, it can flexibly handle application configuration management, service discovery, public network exposure, and automatic scaling issues.

### Public Cloud

If your business requires operation within a public cloud environment, you can directly use the [public cloud services provided by Sealos](https://cloud.sealos.io).

#### Capabilities of Sealos

- 🚀 **Application Management**: Easy management and quick release of publicly accessible distributed applications in the app store.
- 🗄️ **Database Management**: Create high-availability databases in seconds, offering support for MySQL, PostgreSQL, MongoDB, and Redis.
- 🌥️ **Cloud Universality**: Equally effective in both public and private cloud, enabling a seamless transition of traditional applications to the cloud.

#### Advantages of Sealos

- 💰 **Efficient & Economical**: Pay solely for the containers you utilize; automatic scaling prevents resource squandering and substantially reduces costs.
- 🌐 **High Universality & Ease of Use**: Concentrate on your core business activities without worrying about system complexities; negligible learning costs involved.
- 🛡️ **Agility & Security**: The distinctive multi-tenancy sharing model ensures both effective resource segmentation and collaboration, all under a secure framework.

### Private Cloud

The Sealos cloud operating system is **100% open source**. You can find all source code on [GitHub](https://github.com/labring/sealos), which means all features of the **Sealos Public Cloud** can also be deployed in a private cloud environment to meet more diversified business needs.

### Strong Application Delivery Capability

- Sealos has excellent Kubernetes life cycle management capabilities, and you can freely customize the Kubernetes environment.
- Sealos can package an entire cluster and deliver it to the customer environment with a single click. All services and businesses can be delivered as a whole.
- Unlike Docker, which mainly focuses on single-machine imaging, Sealos goes further, packaging the **entire cluster** or a distributed application.

---

### Archived 5.0 Docs Intro (`docs/archived/5.0/docs/Intro.md`)

---
keywords: [cloud operating system, Kubernetes, Sealos, cloud-native, distributed applications, private cloud, public cloud, high-availability, cluster imaging, app store]
description: Sealos is a cloud operating system based on Kubernetes, enabling effortless cloud usage with high-availability and flexible app store capabilities for both public and private clouds.
---

import Highlight from '@site/src/components/Highlight'

# What is Sealos?

<Highlight content="Try Sealos now" url="https://cloud.sealos.io" />

The vastness and complexity of the cloud-native ecosystem undoubtedly leaves many businesses in disarray, yearning for
an efficient, ready-to-use distribution, which this ecosystem sorely lacks. The cloud-native market is in dire need of a
cloud operating system to further reduce barriers and costs.

The advent of Sealos opens a new window for enterprises. It provides a novel choice for businesses and developers alike,
necessitating only the installation of a cloud operating system, regardless of public or private cloud use. It allows
various applications to operate stably and securely, tackling all sorts of dependency issues they might require.

Sealos adheres to the philosophy that **cloud usage can be as simple as Linux**. You can commence usage right after
installation, as you would with Linux, without entanglement in excessive complexities. The sole difference is that while
Linux is installed on a single server, Sealos is installed across an entire data center.

In Sealos's architecture, **there's no essential difference between public and private clouds**. They should be separate
instances of the same codebase, the only distinction lying in their configuration and installed applications. Installing
it on an intranet renders it a private cloud, while offering services on the public internet converts it into a public
cloud.

We firmly believe that with the continuous development and advancement of Sealos, the future of cloud computing will be
more open, more straightforward. The benefits of cloud computing should belong to all providers of computational power,
and the value of the cloud should be shared by all participants of cloud computing. **They will be able to enjoy the
various conveniences of cloud computing in a more economical fashion in a diversified market environment.**

## Overview

Sealos is a **cloud operating system distribution** based on the Kubernetes kernel. It adopts a cloud-native approach,
discarding traditional cloud computing architecture, and shifting towards a new architecture with Kubernetes as the
cloud kernel. This allows enterprises to use the cloud **as effortlessly as they would use a personal computer**.

Users will be able to install any high-availability distributed application on Kubernetes with the click of a button,
similar to using a personal computer. It practically requires no professional delivery or operational costs.
Simultaneously, utilizing unique cluster imaging capabilities, users can package any distributed application into an OCI
image, freely combine a variety of distributed applications, and easily customize their desired cloud. The powerful and
flexible app store function can meet the diverse needs of various users.



## Scenarios & Advantages

Sealos is a powerful business operating platform, providing flawless support for various applications such as Java, Go,
Python, PHP, and more, unrestricted by the programming language. The platform offers a stable operating environment for
applications and resolves backend dependency issues like databases, object storage, and messaging queues. Further, it
can flexibly handle application configuration management, service discovery, public network exposure, and automatic
scaling issues.

### Public Cloud

If your business requires operation within a public cloud environment, you can directly use
the [public cloud services provided by Sealos](https://cloud.sealos.io).

#### Capabilities of Sealos

- 🚀 **Application Management**: Easy management and quick release of publicly accessible distributed applications in the
  app store.
- 🗄️ **Database Management**: Create high-availability databases in seconds, offering support for MySQL, PostgreSQL,
  MongoDB, and Redis.
- 🌥️ **Cloud Universality**: Equally effective in both public and private cloud, enabling a seamless transition of
  traditional applications to the cloud.

#### Advantages of Sealos

- 💰 **Efficient & Economical**: Pay solely for the containers you utilize; automatic scaling prevents resource
  squandering and substantially reduces costs.
- 🌐 **High Universality & Ease of Use**: Concentrate on your core business activities without worrying about system
  complexities; negligible learning costs involved.
- 🛡️ **Agility & Security**: The distinctive multi-tenancy sharing model ensures both effective resource segmentation
  and collaboration, all under a secure framework.

### Private Cloud

The Sealos cloud operating system is **100% open source**. You can find all source code
on [GitHub](https://github.com/labring/sealos), which means all features of the **Sealos Public Cloud** can also be
deployed in a private cloud environment to meet more diversified business needs.

### Strong Application Delivery Capability

- Sealos has excellent Kubernetes life cycle management capabilities, and you can freely customize the Kubernetes
  environment.
- Sealos can package an entire cluster and deliver it to the customer environment with a single click. All services and
  businesses can be delivered as a whole.
- Unlike Docker, which mainly focuses on single-machine imaging, Sealos goes further, packaging the **entire cluster**
  or a distributed application.

---

### Archived 4.0 I18n Zh Hans Intro (`docs/archived/4.0/i18n/zh-Hans/Intro.md`)

import Highlight from '@site/src/components/Highlight'

# 什么是 Sealos？

<Highlight content="在线使用 Sealos" url="https://cloud.sealos.io" />

云原生生态之庞大与复杂，无疑让许多企业感到手足无措，这个生态依然缺乏好用的、开箱即用的发行版。在云原生市场还急需一款云操作系统以进一步降低云原生门槛与成本。

Sealos 的问世为企业开启了一扇新窗。它为企业与开发者提供了一种全新的选择，无论在公有云还是私有云中，都只需安装一个云操作系统。它能让各类应用在操作系统上稳定安全地运行，一并解决了应用所需的各种依赖问题。

Sealos 坚守的理念是：**云可以像 Linux 一样简单**。你可以像使用 Linux 一样安装后立即投入使用，使用过程无需过多纠结。唯一的差别仅在于，Linux 是安装在单一服务器上，而 Sealos 则是安装在整个数据中心。

在 Sealos 的架构中，**公有云与私有云并无本质上的差异**，他们应是同一套代码的不同实例，唯一的区别仅在于配置与所安装应用的差异。在内网安装即是私有云，而在公网对外提供服务则成为公有云。

我们坚信，随着 Sealos 的不断发展与进步，未来的云将更加开放，更加简单。云计算的美好将属于所有算力的提供者，云的价值将由所有云计算的参与者共享。**他们将能够在多元化的市场环境中，以更经济的方式享受云计算所带来的种种便利。**

## 概述

Sealos 是一款以 Kubernetes 为内核的**云操作系统发行版**。它以云原生的方式，抛弃了传统的云计算架构，转向以 Kubernetes 为云内核的新架构，使企业能够**像使用个人电脑一样**简单地使用云。

用户将可以像使用个人电脑一样在 Kubernetes 上一键安装任意高可用分布式应用，几乎不需要任何专业的交付和运维成本。同时，利用独特的集群镜像能力，用户可将任意分布式应用打包成 OCI 镜像，自由组合各种分布式应用，轻松订制所需的云。通过强大且灵活的应用商店功能，可满足各类用户的多样化需求。



## 适用场景 & 优势

Sealos 是一款强大的业务运行平台，它能完美支持 Java、Go、Python、PHP 等各类应用，不受编程语言限制。该平台为应用提供稳定的运行环境，并解决后端依赖问题，例如数据库、对象存储和消息队列等。更进一步，它还能灵活处理应用配置管理、服务发现、公网暴露，以及自动伸缩等问题。

### 公有云

如果您的业务需要运行在公有云环境中，那么您可以直接使用 [Sealos 提供的公有云服务](https://cloud.sealos.io)。

#### Sealos 的能力

- 🚀 **应用管理**：在应用商店中轻松管理并快速发布可公网访问的分布式应用。
- 🗄️ **数据库管理**：秒级创建高可用数据库，支持 MySQL、PostgreSQL、MongoDB 和 Redis。
- 🌥️ **公私一致**：即是公有云也是私有云，支持传统应用无缝迁移到云环境。

#### Sealos 的优势

- 💰 **高效 & 经济**：仅需为容器付费，自动伸缩杜绝资源浪费，大幅度节省成本。
- 🌐 **通用性强，无心智负担**：专注于业务本身，无需担心复杂性，几乎没有学习成本。
- 🛡️ **灵活 & 安全**：多租户共享机制在确保安全的同时，实现资源隔离与高效协作。

### 私有云

Sealos 云操作系统 **100% 开源**，您可在 [GitHub](https://github.com/labring/sealos) 上找到所有源代码，因此 **Sealos 公有云**的全部功能也可以部署在私有云环境中，以满足您更多样化的业务需求。

### 强大的应用交付能力

- Sealos 具备优秀的 Kubernetes 生命周期管理能力，还可以自由定制 Kubernetes 环境。
- Sealos 可以将整个集群打包，并一键交付到客户环境中。所有服务和业务都可以整体交付。
- 不同于 Docker 主要关注单机镜像，Sealos 更进一步，可以将**整个集群**或者某个分布式应用进行打包。

---

### Archived 5.0 I18n Zh Hans Intro (`docs/archived/5.0/i18n/zh-Hans/Intro.md`)

---
description: Sealos是基于Kubernetes的云操作系统，简化云原生部署。它支持公私云环境，提供应用和数据库管理，实现高效经济的云计算体验。探索Sealos，开启简单云计算之旅。
keywords: [Sealos, 云操作系统, Kubernetes, 云原生, 公有云, 私有云, 分布式应用, 应用管理, 数据库管理, 云计算]
---

import Highlight from '@site/src/components/Highlight'

# 什么是 Sealos？

<Highlight content="在线使用 Sealos" url="https://cloud.sealos.io" />

云原生生态之庞大与复杂，无疑让许多企业感到手足无措，这个生态依然缺乏好用的、开箱即用的发行版。在云原生市场还急需一款云操作系统以进一步降低云原生门槛与成本。

Sealos 的问世为企业开启了一扇新窗。它为企业与开发者提供了一种全新的选择，无论在公有云还是私有云中，都只需安装一个云操作系统。它能让各类应用在操作系统上稳定安全地运行，一并解决了应用所需的各种依赖问题。

Sealos 坚守的理念是：**云可以像 Linux 一样简单**。你可以像使用 Linux 一样安装后立即投入使用，使用过程无需过多纠结。唯一的差别仅在于，Linux 是安装在单一服务器上，而 Sealos 则是安装在整个数据中心。

在 Sealos 的架构中，**公有云与私有云并无本质上的差异**，他们应是同一套代码的不同实例，唯一的区别仅在于配置与所安装应用的差异。在内网安装即是私有云，而在公网对外提供服务则成为公有云。

我们坚信，随着 Sealos 的不断发展与进步，未来的云将更加开放，更加简单。云计算的美好将属于所有算力的提供者，云的价值将由所有云计算的参与者共享。**他们将能够在多元化的市场环境中，以更经济的方式享受云计算所带来的种种便利。**

## 概述

Sealos 是一款以 Kubernetes 为内核的**云操作系统发行版**。它以云原生的方式，抛弃了传统的云计算架构，转向以 Kubernetes 为云内核的新架构，使企业能够**像使用个人电脑一样**简单地使用云。

用户将可以像使用个人电脑一样在 Kubernetes 上一键安装任意高可用分布式应用，几乎不需要任何专业的交付和运维成本。同时，利用独特的集群镜像能力，用户可将任意分布式应用打包成 OCI 镜像，自由组合各种分布式应用，轻松订制所需的云。通过强大且灵活的应用商店功能，可满足各类用户的多样化需求。



## 适用场景 & 优势

Sealos 是一款强大的业务运行平台，它能完美支持 Java、Go、Python、PHP 等各类应用，不受编程语言限制。该平台为应用提供稳定的运行环境，并解决后端依赖问题，例如数据库、对象存储和消息队列等。更进一步，它还能灵活处理应用配置管理、服务发现、公网暴露，以及自动伸缩等问题。

### 公有云

如果您的业务需要运行在公有云环境中，那么您可以直接使用 [Sealos 提供的公有云服务](https://cloud.sealos.io)。

#### Sealos 的能力

- 🚀 **应用管理**：在应用商店中轻松管理并快速发布可公网访问的分布式应用。
- 🗄️ **数据库管理**：秒级创建高可用数据库，支持 MySQL、PostgreSQL、MongoDB 和 Redis。
- 🌥️ **公私一致**：即是公有云也是私有云，支持传统应用无缝迁移到云环境。

#### Sealos 的优势

- 💰 **高效 & 经济**：仅需为容器付费，自动伸缩杜绝资源浪费，大幅度节省成本。
- 🌐 **通用性强，无心智负担**：专注于业务本身，无需担心复杂性，几乎没有学习成本。
- 🛡️ **灵活 & 安全**：多租户共享机制在确保安全的同时，实现资源隔离与高效协作。

### 私有云

Sealos 云操作系统 **100% 开源**，您可在 [GitHub](https://github.com/labring/sealos) 上找到所有源代码，因此 **Sealos 公有云**的全部功能也可以部署在私有云环境中，以满足您更多样化的业务需求。

### 强大的应用交付能力

- Sealos 具备优秀的 Kubernetes 生命周期管理能力，还可以自由定制 Kubernetes 环境。
- Sealos 可以将整个集群打包，并一键交付到客户环境中。所有服务和业务都可以整体交付。
- 不同于 Docker 主要关注单机镜像，Sealos 更进一步，可以将**整个集群**或者某个分布式应用进行打包。

---

### Archived 3.0 README En (`docs/archived/3.0/README_en.md`)

[](https://github.com/labring/sealos)
[](https://github.com/labring/sealos/actions)
[](https://sealyun.com)
[](https://goreportcard.com/report/github.com/labring/sealos)
[](https://t.me/gsealyun)
---
**Document: _[Official document](https://www.sealyun.com/instructions), [中文文档](/README.md), [Blog](https://fuckcloudnative.io)_**

**Organization: _DingTalk(35371178), [Telegram](https://t.me/cloudnativer)_**
---
# Introduction
Build a kubernetes HA cluster for a production environment.


* Each node will be configured with an ipvs proxy for masters LB, so we needn't haproxy or keepalived any more.
* Then run a [lvscare](https://github.com/labring/lvscare) as a staic pod to check apiserver is aviliable. `/etc/kubernetes/manifests/sealyun-lvscare.yaml`
* If any master is down, lvscare will remove the ipvs realserver, when master recover it will add it back.
* Sealos will send package and apply install commands, so we needn't ansible.

# ✨ Supported Environment

## Linux Distributions, CPU Architecture

- Debian 9+,  x86_64/ arm64
- Ubuntu 16.04， 18.04， 20.04 ,  x86_64/ arm64
- Centos/RHEL 7.6+,  x86_64/ arm64
- 99% systemd manage linux system， x86_64/ arm64
- Kylin arm64

## kubernetes Versions

- 1.16+
- 1.17+
- 1.18+
- 1.19+
- 1.20+
- 1.21+
- 1.22+
- 1.23+

Looking for more supported versions, [sealyun.com](https://www.sealyun.com).

## Requirements and Recommendations

- Minimum resource requirements
   - 2 vCpu
   - 4G RAM
   - 40G+ Storage

- OS requirements
   - SSH can access to all nodes.
   - These nodes have unique host names that meet the hostname requirements for kubernetes.
   - Time synchronization for all nodes.
   - Network Iface name is unique, it is recommended to change it to a standard NIC name, such as (eth.|en.|em.*).
   - Kubernetes1.20+, use containerd for default cri. user should not to install containerd or docker-ce. sealos will do it
   - Kubernetes1.19-, use docker for default cri. user should not to install docker-ce. sealos will do it for you
- Networking and DNS requirements：
  - Make sure the DNS address in /etc/resolv.conf is available. Otherwise, it may cause some issues of DNS in cluster。 
  - If you use Ali cloud or Huawei cloud host to deploy.  The default pod segment will conflict with AliCloud's dns segment, it is recommended to customize the pod segment by specifying --podcidr during init.
  - Sealos disables the firewall by default ，If you need to open the firewall, it is recommended to release the relevant ports manually.
- Kernel requirements:
  - The cni component requires a kernel version of not less than 5.4 when selecting cilium
  
# Tips
- If you use Tencent Cloud Hosting to deploy, calico's IPIP rules are disabled by default, and you need to change to VXLAN rules to use it properly.


# 🚀 Quick Start

> Environmental information

Hostname|IP Address
---|---
master0|192.168.0.2
master1|192.168.0.3
master2|192.168.0.4
node0|192.168.0.5

Server password：123456

**kubernetes .0, the version is not recommended for production environment!!!**

> Just prepare the server and execute the following command on any server

```bash
# download and install sealos, sealos is a binary tool of golang, just download and copy directly to the bin directory, the release page can also be downloaded
wget -c https://sealyun-home.oss-cn-beijing.aliyuncs.com/sealos/latest/sealos && \
    chmod +x sealos && mv sealos /usr/bin

# download offline resource pack
wget -c https://sealyun.oss-cn-beijing.aliyuncs.com/05a3db657821277f5f3b92d834bbaf98-v1.22.0/kube1.22.0.tar.gz

# Install a three-master kubernetes cluster
sealos init --passwd '123456' \
	--master 192.168.0.2  --master 192.168.0.3  --master 192.168.0.4  \
	--node 192.168.0.5 \
	--pkg-url /root/kube1.22.0.tar.gz \
	--version v1.22.0
```

> Parameter meaning

| parameter | meaning                                                                                                      | example                 |
|-----------|--------------------------------------------------------------------------------------------------------------|-------------------------|
| passwd    | server password                                                                                              | 123456                  |
| master    | k8s master IP Address                                                                                        | 192.168.0.2             |
| node      | k8s node IP Address                                                                                          | 192.168.0.3             |
| pkg-url   | offline resource package address, support downloading to local or a remote address                           | /root/kube1.22.0.tar.gz |
| version   | [Resource pack](https://www.sealyun.com/goodsList) Corresponding version | v1.22.0                 |


> add master

```bash
🐳 → sealos join --master 192.168.0.6 --master 192.168.0.7
🐳 → sealos join --master 192.168.0.6-192.168.0.9  # or multiple consecutive IPs
```

> add node

```bash
🐳 → sealos join --node 192.168.0.6 --node 192.168.0.7
🐳 → sealos join --node 192.168.0.6-192.168.0.9  # or multiple consecutive IPs
```

> delete the specified master

```bash
🐳 → sealos clean --master 192.168.0.6 --master 192.168.0.7
🐳 → sealos clean --master 192.168.0.6-192.168.0.9  # or multiple consecutive IPs
```

> Delete the specified node

```bash
🐳 → sealos clean --node 192.168.0.6 --node 192.168.0.7
🐳 → sealos clean --node 192.168.0.6-192.168.0.9  # or multiple consecutive IPs
```

> clean up the cluster

```bash
🐳 → sealos clean --all
```

# ✅ Feature

- [x] Support ARM version offline package, v1.20 version offline package supports containerd integration, completely abandon docker
- [x] 99 years certificate, support cluster backup and upgrade
- [x] No dependency on ansible haproxy keepalived, a binary tool, 0 dependency
- [x] Offline installation, different versions of kubernetes download corresponding to different versions [Resource pack](https://www.sealyun.com/goodsDetail?type=cloud_kernel&name=kubernetes), Offline package contains all binary files configuration files and images
- [x] High-availability local LIB implemented through ipvs, which takes up less resources, is stable and reliable, and is similar to the implementation of kube-proxy
- [x] Almost compatible with all environments that support systemd x86_64 architecture
- [x] Easily add and delete cluster nodes
- [x] Thousands of users use sealos in the online environment, which is stable and reliable
- [x] The resource pack is placed on Alibaba Cloud OSS, so you don’t have to worry about network speed anymore

# 📊 Stats



## Star History

[](https://star-history.com/#fanux/sealos&Date)

---

### Archived 3.0 README Zh (`docs/archived/3.0/README_zh.md`)

# ⚠️ 风险须知

**由于sealos可以把一周的工作量缩短到三分钟，可能会导致您工作不饱满而被老板炒鱿鱼**

<a href="https://trackgit.com">
  <img src="https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/kexrkhvqjlzkdiap4zke" alt="trackgit-views" />
</a>



<div align="center">
  <p>
    <b>一条命令部署 Kubernetes 高可用集群 👋</b>
  </p>
  <p>
     <i>以kubernetes为内核的云操作系统发行版，让云原生简单普及。一条命令高可用安装任意版本kubernetes，支持离线，包含所有依赖，内核负载不依赖haproxy keepalived,纯golang开发,99年证书</i>
  </p>
  <p>

  [](https://github.com/labring/sealos)
  [](https://github.com/labring/sealos/actions)
  [](https://sealyun.com)
  [](https://goreportcard.com/report/github.com/labring/sealos)
  [](https://t.me/gsealyun)

  </p>
</div>

---

**文档: _[官方文档](https://www.sealyun.com/instructions/1st), [English Docs](/README_en.md), [博客](https://fuckcloudnative.io)_**

**加入组织: 钉钉群(35371178), [Telegram](https://t.me/gsealyun), QQ群（98488045）,作者微信：fangnux** 

**4.0.0版本: _[sealos4.0](https://github.com/labring/sealos/tree/release-v4.0.0/docs/4.0)_**



# ✨ 支持的环境

## Linux 发行版, CPU架构

- Debian 9+,  x86_64/ arm64
- Ubuntu 16.04, 18.04, 20.04,  x86_64/ arm64
- Centos/RHEL 7.6+,  x86_64/ arm64
- 其他支持 systemd 的系统环境,  x86_64/ arm64
- Kylin arm64

## kubernetes 版本

- 1.16+
- 1.17+
- 1.18+
- 1.19+
- 1.20+
- 1.21+
- 1.22+
- 1.23+

只要kubernetes发布了新版本，sealos半天之内即可支持，更多版本支持, 详细查看[sealyun.com](https://www.sealyun.com)

## 要求和建议

- 最低资源要求
   - 2 vCpu
   - 4G Ram
   - 40G+ 存储

- 操作系统要求
   - ssh 可以访问各安装节点
   - 各节点主机名不相同，并满足kubernetes的主机名要求。
   - 各节点时间同步
   - 网卡名称如果是不常见的，建议修改成规范的网卡名称， 如(eth.*|en.*|em.*)
   - kubernetes1.20+ 使用containerd作为cri. 不需要用户安装docker/containerd. sealos会安装1.3.9版本containerd。
   - kubernetes1.19及以下 使用docker作为cri。 也不需要用户安装docker。 sealos会安装1.19.03版本docker
 - 网络和 DNS 要求：
   - 确保 /etc/resolv.conf 中的 DNS 地址可用。否则，可能会导致群集中coredns异常。
   - 如果使用阿里云/华为云主机部署。 默认的pod网段会和阿里云的dns网段冲突， 建议自定义修改pod网段, 在init的时候指定`--podcidr` 来修改。
   - sealos 默认会关闭防火墙， 如果需要打开防火墙， 建议手动放行相关的端口。
 - 内核要求:
   - cni组件选择cilium时要求内核版本不低于5.4

# 🚀 快速开始

> 环境信息

主机名|IP地址
---|---
master0|192.168.0.2
master1|192.168.0.3
master2|192.168.0.4
node0|192.168.0.5

服务器密码：123456

**kubernetes .0版本不建议上生产环境!!!**

> 只需要准备好服务器，在任意一台服务器上执行下面命令即可

```sh
# 下载并安装sealos, sealos是个golang的二进制工具，直接下载拷贝到bin目录即可, release页面也可下载
$ wget -c https://sealyun-home.oss-cn-beijing.aliyuncs.com/sealos/latest/sealos && \
    chmod +x sealos && mv sealos /usr/bin

# 下载离线资源包
$ wget -c https://sealyun.oss-cn-beijing.aliyuncs.com/05a3db657821277f5f3b92d834bbaf98-v1.22.0/kube1.22.0.tar.gz

# 安装一个三master的kubernetes集群
$ sealos init --passwd '123456' \
	--master 192.168.0.2  --master 192.168.0.3  --master 192.168.0.4  \
	--node 192.168.0.5 \
	--pkg-url /root/kube1.22.0.tar.gz \
	--version v1.22.0
# 检查安装是否成功
$ kubectl get node -owide
```

> 参数含义

参数名|含义|示例
---|---|---
passwd|服务器密码|123456
master|k8s master节点IP地址| 192.168.0.2
node|k8s node节点IP地址|192.168.0.3
pkg-url|离线资源包地址，支持下载到本地，或者一个远程地址|/root/kube1.22.0.tar.gz
version|[资源包](https://www.sealyun.com/goodsDetail?type=cloud_kernel&name=kubernetes)对应的版本|v1.22.0

> 增加master

```shell script
🐳 → sealos join --master 192.168.0.6 --master 192.168.0.7
🐳 → sealos join --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 增加node

```shell script
🐳 → sealos join --node 192.168.0.6 --node 192.168.0.7
🐳 → sealos join --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```
> 删除指定master节点

```shell script
🐳 → sealos clean --master 192.168.0.6 --master 192.168.0.7
🐳 → sealos clean --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 删除指定node节点

```shell script
🐳 → sealos clean --node 192.168.0.6 --node 192.168.0.7
🐳 → sealos clean --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 清理集群

```shell script
🐳 → sealos clean --all
```

# ✅ 特性

- [x] 支持ARM版本离线包，v1.20版本离线包支持containerd集成，完全抛弃docker
- [x] 99年证书, 支持集群备份，升级
- [x] 不依赖ansible haproxy keepalived, 一个二进制工具，0依赖
- [x] 离线安装，不同kubernetes版本下载对应不同版本的[资源包](https://www.sealyun.com/goodsDetail?type=cloud_kernel&name=kubernetes)即可,离线包包含所有二进制文件配置文件和镜像
- [x] 高可用通过ipvs实现的localLB，占用资源少，稳定可靠，类似kube-proxy的实现
- [x] 几乎可兼容所有支持systemd的x86_64架构的环境
- [x] 轻松实现集群节点的增加/删除
- [x] 上千用户在线上环境使用sealos，稳定可靠
- [x] 资源包放在阿里云oss上，再也不用担心网速
- [x] dashboard ingress prometheus等APP 同样离线打包，一键安装
- [x] 支持集群镜像，自由组合定制你需要的集群，如openebs存储+数据库+minio对象存储

# 📊 Stats



## Star History

[](https://star-history.com/#fanux/sealos&Date)

---

### Archived 3.0 Quick Start (`docs/archived/3.0/quick_start.md`)

# 快速开始

> 环境信息

| 主机名  | IP地址      |
| ------- | ----------- |
| master0 | 192.168.0.2 |
| master1 | 192.168.0.3 |
| master2 | 192.168.0.4 |
| node0   | 192.168.0.5 |

服务器密码：123456

**kubernetes高可用安装教程**

> 只需要准备好服务器，在任意一台服务器上执行下面命令即可

**kubernetes 修订版本号为0的版本（比如1.14.0，1.15.0等）不建议上生产环境!!!**

```sh
# 下载并安装sealos, sealos是个golang的二进制工具，直接下载拷贝到bin目录即可, release页面也可下载
$ wget -c https://sealyun.oss-cn-beijing.aliyuncs.com/latest/sealos && \
    chmod +x sealos && mv sealos /usr/bin 

# 下载离线资源包
$ wget -c https://sealyun.oss-cn-beijing.aliyuncs.com/05a3db657821277f5f3b92d834bbaf98-v1.22.0/kube1.22.0.tar.gz

# 安装一个三master的kubernetes集群
$ sealos init --passwd '123456' \
	--master 192.168.0.2  --master 192.168.0.3  --master 192.168.0.4  \
	--node 192.168.0.5 \
	--pkg-url /root/kube1.22.0.tar.gz \
	--version v1.22.0
```

> 参数含义

| 参数名  | 含义                                                         | 示例                    |
| ------- | ------------------------------------------------------------ | ----------------------- |
| passwd  | 服务器密码                                                   | 123456                  |
| master  | k8s master节点IP地址                                         | 192.168.0.2             |
| node    | k8s node节点IP地址                                           | 192.168.0.3             |
| pkg-url | 离线资源包地址，支持下载到本地，或者一个远程地址             | /root/kube1.22.0.tar.gz |
| version | [资源包](https://www.sealyun.com/goodsList) 对应的版本 | v1.22.0                 |

> 增加master

```bash
sealos join --master 192.168.0.6 --master 192.168.0.7
sealos join --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 增加node

```bash
sealos join --node 192.168.0.6 --node 192.168.0.7
sealos join --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```
> 删除指定master节点

```bash
sealos clean --master 192.168.0.6 --master 192.168.0.7
sealos clean --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 删除指定node节点

```bash
sealos clean --node 192.168.0.6 --node 192.168.0.7
sealos clean --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

> 清理集群

```bash
sealos clean --all
```

> 备份集群

```bash
sealos etcd save
```

**注意事项**

- 必须同步所有服务器时间
- 所有服务器主机名不能重复
- 系统支持：centos7.6以上 ubuntu16.04以上
- 内核推荐4.14以上， 系统推荐：centos7.7

---

### Archived 3.0 User Guide (`docs/archived/3.0/user_guide.md`)

# 使用教程
## 前提条件
* 安装并启动docker/containerd(1.20+安装containerd),**已经安装了会重启docker/containerd.** 高版本离线包自带docker/containerd，如没安装docker/containerd会自动安装.
* 下载[kubernetes 离线安装包](https://www.sealyun.com/goodsList).
* 下载[最新版本sealos](https://github.com/labring/sealos/releases).
* 务必同步服务器时间
* 主机名不可重复
* master节点CPU必须2C以上
* 请使用sealos 3.2.0以上版本

## [视频教程](http://mp.weixin.qq.com/mp/video?__biz=Mzg2NzAzODE5Ng==&mid=100000268&sn=e932ef75dfc38414c21b6b365df07c8e&vid=wxv_1003349861900664832&idx=1&vidsn=e934d4cf8bacd1f569514b69c1344cf6&fromid=1&scene=18&xtrack=1#wechat_redirect)

## 安装教程
多master HA:
```bash
sealos init --master 192.168.0.2 \
    --master 192.168.0.3 \
    --master 192.168.0.4 \
    --node 192.168.0.5 \
    --user root \
    --passwd your-server-password \
    --version v1.14.1 \
    --pkg-url /root/kube1.14.1.tar.gz     
```

或者单master多node:
```bash
sealos init --master 192.168.0.2 \
    --node 192.168.0.5 \
    --user root \
    --passwd your-server-password \
    --version v1.14.1 \
    --pkg-url /root/kube1.14.1.tar.gz 
```

使用免密钥或者密钥对： 如果密钥对有密码， 添加`--pk-passwd password`
```bash
sealos init --master 172.16.198.83 \
    --node 172.16.198.84 \
    --pkg-url https://YOUR_HTTP_SERVER/kube1.15.0.tar.gz \
    --pk /root/kubernetes.pem \
    --version v1.15.0
```

自定义ssh端口号,如2022：
```bash
sealos init --master 172.16.198.83:2022 \
    --pkg-url https://YOUR_HTTP_SERVER/kube1.15.0.tar.gz \
    --pk /root/kubernetes.pem \
    --version v1.15.0
```

| 参数名         | 含义                                                         | 示例                    | 是否必须             |
| -------------- | ------------------------------------------------------------ | ----------------------- | -------------------- |
| passwd         | 服务器密码                                                   | 123456                  | 和私钥二选一         |
| master         | k8s master节点IP地址                                         | 192.168.0.2             | 必须                 |
| node           | k8s node节点IP地址                                           | 192.168.0.3             | 可选                 |
| pkg-url        | 离线资源包地址，支持下载到本地，或者一个远程地址             | /root/kube1.16.0.tar.gz | 必须                 |
| version        | [资源包](https://www.sealyun.com/goodsList)对应的版本                 | v1.16.0                 | 必须                 |
| kubeadm-config | 自定义kubeadm配置文件                                        | kubeadm.yaml.temp       | 可选                 |
| pk             | ssh私钥地址，免密钥时使用                                    | /root/.ssh/id_rsa       | 和passwd二选一       |
| pk-passwd      | ssh私钥密码                                                  | 默认为空                | 私钥有密码时添加即可 |
| user           | ssh用户名                                                    | root                    | 可选                 |
| interface      | 机器网卡名，CNI网卡发现用                                    | eth.*                   | 可选                 |
| network        | CNI类型如calico flannel                                      | calico                  | 可选                 |
| podcidr        | pod网段                                                      | 100.64.0.0/10           | 可选                 |
| repo           | 镜像仓库,离线包通常不用配置,除非你把镜像导入到自己私有仓库了 | k8s.gcr.io              | 可选                 |
| svccidr        | clusterip网段                                                | 10.96.0.0/12            | 可选                 |
| vlog           | kubeadm 日志等级                                             | 5                       | 可选                 |
| cert-sans      | kubernetes apiServerCertSANs                                 | sealyun.com             | 可选                 |
| without-cni    | 不装cni插件，为了用户自己装别的CNI                           | 默认安装calico-cni      | 可选                 |

具体详细参数执行 sealos init --help

检查安装是否正常:
```
/* Detailed source-code truncated for AI context efficiency. */
```

## 清理
```bash
sealos clean --all
```
## 增加master

```bash
sealos join --master 192.168.0.6 --master 192.168.0.7
sealos join --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

## 增加node

```bash
sealos join --node 192.168.0.6 --node 192.168.0.7
sealos join --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```
## 删除指定master节点

注意clean不加任何参数会清理整个集群

```bash
sealos clean --master 192.168.0.6 --master 192.168.0.7
sealos clean --master 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

## 删除指定node节点

```bash
sealos clean --node 192.168.0.6 --node 192.168.0.7
sealos clean --node 192.168.0.6-192.168.0.9  # 或者多个连续IP
```

## 自定义网络

* podcidr 参数指定自定义pod网段 如 --podcidr 100.64.0.0/10
* svccidr 参数指定clusterip网段 如 --svccidr 10.96.0.0/12
* without-cni sealos自带calico网络，如果你想自己装CNI不用默认可加此参数， 如 sealos init --without-cni .....


## 添加apiServerCertSans证书

如果仅仅需要添加证书， 在`init`的时候指定`--cert-sans sealyun.com`即可

```bash
sealos init --cert-sans sealyun.com \
    --master 192.168.0.2 \
    --master 192.168.0.3 \
    --master 192.168.0.4 \
    --node 192.168.0.5 \
    --user root \
    --passwd your-server-password \
    --version v1.14.1 \
    --pkg-url /root/kube1.14.1.tar.gz 
```

## 使用自定义kubeadm配置文件
比如我们需要在证书里加入 `sealyun.com`， 自定义`pod`网络 修改 `{{.PodCIDR}}` 为你想要的网段即可 :

先获取配置文件模板：

```bash
sealos config -t kubeadm >>  kubeadm-config.yaml.tmpl
```

修改`kubeadm-config.yaml.tmpl`,文件即可， 编辑增加 `sealyun.com`, 注意其它部分不用动，sealos会自动填充模板里面的内容:

```yaml
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: {{.Master0}}
  bindPort: 6443
---
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: {{.Version}}
controlPlaneEndpoint: "{{.ApiServer}}:6443"
imageRepository: {{.Repo}}
networking:
  # dnsDomain: cluster.local
  podSubnet: {{.PodCIDR}}
  serviceSubnet: {{.SvcCIDR}}
apiServer:
  certSANs:
  - 127.0.0.1
  - sealyun.com
  - {{.ApiServer}}
  {{range .Masters -}}
  - {{.}}
  {{end -}}
  {{range .CertSANS -}}
  - {{.}}
  {{end -}}
  - {{.VIP}}
  extraArgs:
    feature-gates: TTLAfterFinished=true
  extraVolumes:
  - name: localtime
    hostPath: /etc/localtime
    mountPath: /etc/localtime
    readOnly: true
    pathType: File
controllerManager:
  extraArgs:
    feature-gates: TTLAfterFinished=true
    experimental-cluster-signing-duration: 876000h
  extraVolumes:
  - hostPath: /etc/localtime
    mountPath: /etc/localtime
    name: localtime
    readOnly: true
    pathType: File
scheduler:
  extraArgs:
    feature-gates: TTLAfterFinished=true
  extraVolumes:
  - hostPath: /etc/localtime
    mountPath: /etc/localtime
    name: localtime
    readOnly: true
    pathType: File
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: "ipvs"
ipvs:
  excludeCIDRs: 
  - "{{.VIP}}/32"
```

使用 --kubeadm-config 指定配置文件模板即可:

```sh
sealos init --kubeadm-config kubeadm-config.yaml.tmpl \
    --master 192.168.0.2 \
    --master 192.168.0.3 \
    --master 192.168.0.4 \
    --node 192.168.0.5 \
    --user root \
    --passwd your-server-password \
    --version v1.14.1 \
    --pkg-url /root/kube1.14.1.tar.gz 
```

## 清理集群

> 清理指定节点

```bash
sealos clean --master 192.168.0.2
sealos clean --node 192.168.0.5
```

> 全部清理. 但是保留`kube1.XX.tar.gz`文件

```bash
sealos clean --all
```

## 备份集群



命令帮助如下，详情[查看github](https://github.com/labring/sealos/docs/etcdbackup.md)

```bash
sealos etcd save -h
Flags:
      --aliId string        aliyun accessKeyId to save snapshot
      --aliKey string       aliyun accessKeySecrets to save snapshot
      --backupPath string   Specify snapshot backup dir (default "/opt/sealos/ectd-backup")
      --bucket string       oss bucketName to save snapshot
      --docker              snapshot your kubernets etcd in container, will add unix timestamp to snapshot name
      --ep string           aliyun endpoints to save snapshot
  -h, --help                help for save
      --name string         Specify snapshot name (default "snapshot")
      --objectPath string   aliyun oss objectPath to save snapshot, like: /sealos/snapshots/
```

1. 本地备份, 默认保存在`/opt/sealos/ectd-backup`这个目录， 默认名称为`sanpshot`

```bash
sealos etcd save
```

2. 本地备份并复制到各`master`节点。增加`--docker`， 默认在生成的文件下添加当前的`uinx`时间戳
   然后复制到`master`节点

```bash
sealos etcd save --docker
```

3. 备份上传至oss，首次执行带命令行或者编辑`~/.sealos/config.yaml`

```bash
sealos etcd save --docker \
    --aliId youraliyunkeyid \
    --aliKey youraliyunkeysecrets \
    --ep oss-cn-hangzhou.aliyuncs.com  \
    --bucket etcdbackup  \
    --objectPath /sealos/ 
```

---

### Frontend Desktop Docs Oauth Authorization Code (`frontend/desktop/docs/oauth-authorization-code.md`)

# Authorization code + PKCE for native clients

This is an OAuth 2.0 authorization server capability in Web Desktop. It does not migrate the native desktop/mobile apps. Device authorization, existing JWT refresh tokens, and their consent routes retain their current behavior.

## Enable and register

Deploy the new global database migration before enabling the flow. Use the migration directory for the configured provider (CockroachDB or PostgreSQL), then regenerate its Prisma client. The PostgreSQL migration also adds the existing OAuth models missing from that provider's schema.

In the Desktop server configuration, set `desktop.auth.oauth2idp.enabled: true` and `desktop.auth.oauth2idp.authorizationCodeEnabled: true`. The second flag defaults to false. Configure `desktop.auth.callbackURL` with the correct public HTTPS origin; decision requests compare their Origin header against it. Disabling only the new flag blocks authorization and code exchange but permits existing code-flow refresh sessions to refresh or revoke.

Register one PUBLIC OAuthClient per native app. Set `allowedGrantTypes` to include `authorization_code` and `refresh_token`, and populate `redirectUris`. No client secret is required. Existing device clients need no changes. A client may explicitly allow both device and code grants.

Allowed callbacks: exact registered HTTPS URIs; private schemes with reverse-domain naming, such as `io.sealos.mobile:/oauth/callback`; or HTTP loopback IPs `127.0.0.1` / `[::1]`. Only a loopback callback's port may vary. Wildcards, fragments, userinfo and non-loopback HTTP callbacks are not supported. Register loopback without a port, for example `http://127.0.0.1/callback`. Configure mobile OS callback routing separately; verified HTTPS app links require domain association.

## Protocol

1. Generate a fresh cryptographically random state and a 43–128 character verifier for each attempt. Compute `BASE64URL(SHA256(verifier))` without padding.
2. Open the system browser at `GET /api/auth/oauth2/code/authorize` with `response_type=code`, `client_id`, `redirect_uri`, `state`, `code_challenge`, and `code_challenge_method=S256`. Do not request scopes in this release: nonempty scope returns `invalid_scope`.
3. The server creates a ten-minute browser-bound request and opens `/oauth2/code`. Existing sign-in methods resume that request after login. The browser must retain the HttpOnly request cookie. Consent shows the current account and existing account-level access.
4. Approval redirects to the registered callback with `code` and the original `state`. Denial redirects with `error=access_denied` and `state`. Reject any callback whose state does not match the initiating attempt. Codes expire after five minutes and are single-use.
5. POST form-urlencoded to `/api/auth/oauth2/token`: `grant_type=authorization_code`, `client_id`, `redirect_uri` (identical to the original), `code`, `code_verifier`.
6. Response: `access_token`, `refresh_token`, `token_type=Bearer`, `expires_in=3600`. No ID token is issued. The access token uses Sealos's existing global token format; existing regional/workspace credential exchange still applies. Use each Sealos business API's existing authorization-header convention rather than assuming every legacy endpoint parses a Bearer prefix.

The native app should store credentials in its OS secure store. Serialize refresh calls: POST `grant_type=refresh_token`, `client_id`, `refresh_token` to the same token endpoint. Always replace the stored refresh token with the latest response. New code-flow refresh tokens are opaque (`sc_rt_` prefix), rotate on each use, and expire after 30 days without a successful refresh. Reusing a consumed token revokes its entire session family, including the newest token. A lost refresh response therefore requires signing in again; do not automatically replay the old token. Other sessions are independent.

To log out, POST form-urlencoded `client_id` and `token` to `/api/auth/oauth2/code/revoke`. The new session family cannot refresh afterward. Unknown or already revoked tokens return HTTP 200. This endpoint does not revoke device-flow tokens. Outstanding access tokens may remain usable for up to one hour; previously exported kubeconfigs are not revoked. This is not immediate account-wide logout.

## Compatibility and operation

- Device endpoints, device pages and device refresh logic are unchanged. No new scope enforcement is applied to them.
- New endpoints share a database-backed limit of 120 requests per minute per client IP. IP extraction follows the existing trusted Higress convention: prevent callers bypassing the ingress and injecting trusted IP headers.
- Expired new authorization requests, expired refresh families (including consumed token hashes) and limiter buckets are pruned opportunistically, at most once per minute per worker. Cleanup failure is retried on subsequent requests. Consumed refresh hashes are retained while their family is active so replay is detectable.
- New schema changes are additive. To stop new adoption, disable the authorization-code flag rather than removing tables needed by active sessions.
- OIDC, fine-grained scopes, workspace selection, a client-registration UI and an authorized-app management UI are deferred.

## Verification

Run the existing Desktop unit suite normally. The OAuth code integration suite uses `OAUTH_TEST_DATABASE_URL` exclusively and is skipped without it. Set `OAUTH_TEST_DB_PROVIDER=cockroachdb` to run the same contracts against a disposable CockroachDB database; the PostgreSQL-only failure-injection trigger test is skipped there. Prepare a disposable PostgreSQL database with this provider's migrations; do not point it at application data. The test creates uniquely named clients/users and deletes them afterward. Its API-boundary tests run actual services, JWT verification, PKCE checks and database transactions, including concurrent code/refresh requests and a real HTTP loopback callback.

From the frontend workspace, in fish:

```fish
env GLOBAL_DATABASE_URL="$OAUTH_TEST_DATABASE_URL" pnpm --dir desktop exec prisma migrate deploy --schema prisma/providers/postgresql/global/schema.prisma
env OAUTH_TEST_DATABASE_URL="$OAUTH_TEST_DATABASE_URL" pnpm --dir desktop exec vitest run src/__tests__/integration/oauth-code.test.ts --project unit
pnpm --dir desktop exec vitest run src/__tests__/components/oauth-code.test.tsx --project components
pnpm --dir desktop exec tsc --noEmit
```

For a manual reference-client smoke test, run `node desktop/scripts/oauth-code-client.mjs https://your-sealos-host registered-client-id`. Register `http://127.0.0.1/callback` for that test client first. The script prints a browser link, receives the callback, exchanges and refreshes the token, revokes the session, and verifies further refresh is denied. It never prints tokens or persists credentials. On mobile, use the same authorization/token parameters with that app's registered callback and system authentication browser.

### Browser smoke test

`env OAUTH_TEST_DATABASE_URL="$OAUTH_TEST_DATABASE_URL" node desktop/scripts/test-oauth-code-browser.mjs` starts an isolated Next development server and Chromium. It exercises the real sign-in UI, resumes the pending request, verifies successful approve/deny navigation to a real loopback callback, and verifies the existing device completion page. Account login and regional credential APIs return fixture credentials; OAuth APIs, cookies, database state and browser navigation are real. It never contacts an external identity provider or Kubernetes API. The script closes its server/browser and deletes its uniquely named fixtures on completion.

Both PostgreSQL migrations from an empty database and the CockroachDB additive migration from the previous schema were exercised against disposable databases, with no schema drift afterward.

---

### Archived 3.0 Command Cloud (`docs/archived/3.0/command/cloud.md`)

# sealos对接公有云
sealos已经把kubernetes安装做的最简单了，然而虽然是一条命令就可能安装k8s集群，填IP，服务器密码等参数任然对于笔者这种懒汉来说还是太麻烦

如何做到三秒安装（操作三秒，刷五分钟抖音）集群就构建成功成为sealos需要思考的。这点对于大部分使用公有云的用户来说成为了可能。

# 使用教程
在不指定任何参数时sealos会根据一些默认参数帮助用户构建一个k8s集群。
```
sealos cloud --accessKey xxx --accessSecret xxx
```
其它参数都为可选参数，安装时不加-y参数会与用户交互提示

参数说明：

参数名 | 参数值例 | 说明 
---|---|---
accessKey| LTAIah2bOOcr0uuT | 如阿里云的accessKey,在[用户信息](https://usercenter.console.aliyun.com/#/manage/ak)中可找到
accessSecret| FN3FcvXUctbudisnHs89bcYlbsZuImh
provider|ali| 云供应商，支持阿里云等
master|3|kubernetes master数量
node|4| kubernetes node数量
version|v1.16.3| kubernetes版本
flavor|2C4G| 2核4G的虚拟机，虚拟机实例类型，也可自己设置阿里云的机型，但是自己设置需要确认是否能兼容可用区等
name|mycluster| kubernetes集群名称
passwd|123456| 虚拟机密码
region|cn-hangzhou| 虚拟机可用区
zone|cn-hangzhou-a| 虚拟机zone
y | 无 | 免交互模式，有些默认值参数需要用户确认，以免起错集群

> 使用阿里云cloudshell

觉得填写accessKey，accessSecret很麻烦可以到cloudshell中执行，就无需填写这两个参数，因为cloudshell已经有这两个参数的环境变量。

构建集群只需要,这是世界上最简单的方式：
```
sealos cloud
```
cloudshell在用户控制台右上角，一个终端小图标



> 起一个3master 4node 的1.14.9集群

```
sealos cloud --master 3 --node 4 \
    --version v1.14.9 --flavor 2C4G \
    --name mytest --passwd test123 \
    --region cn-hangzhou
```

# 执行原理
1. sealos cloud根据参数申请公有云机器
2. 通过FIP连接到master0上下载sealos
3. 在master0上执行sealos init ...

# 关于虚拟机镜像
会使用基于centos7的虚拟机镜像，为了确保100%能安装成功推荐使用我们制作的自定义镜像，收费标准是0.05/小时/台机器

也就是一台机器五分钱一小时。

# 关于实例类型
首个版本支持的是阿里云的竞价实例，竞价实例相比普通实例拥有便宜很多的价格优势，是弹性计算的好选择

# 关于terraform
做了一个艰难的决定没去用terraform, terraform很优秀，对公有云openstack的编排做的非常好，但是没找到它的SDK这意味着只能通过调用命令行工具去使用terraform,这样就增加了sealos的依赖，这违背了sealos简单的原则，所以采用自己基于阿里云和腾讯云的SDK实现此功能

# 商业支持
请邮箱联系：fhtjob@hotmail.com

能提供以下支持：

* sealos定制化开发，支持用户特定要求的实例类型，付费规则等
* 弹性计算定制，在夜间业务低谷期时释放实例缩小k8s集群，大大降低企业使用公有云成本
* 保障集群自身稳定，可靠

PS：sealos定制价格极低，邮件获取报价单

---

### Archived 3.0 Command Etcd (`docs/archived/3.0/command/etcd.md`)

# `sealos etcd` 命令

## 使用`sealos etcd save`

备份落盘位置会在执行sealos的主机上. 同时, restore的时候, 也会恢复在`执行sealos的主机上`, `sealos save` 逻辑是**调用 `etcd clientv3` 生成`snapshot`备份文件.** 

```
$ sealos etcd save -h
Flags:
      --aliId string        aliyun accessKeyId to save snapshot
      --aliKey string       aliyun accessKeySecrets to save snapshot
      --backupPath string   Specify snapshot backup dir (default "/opt/sealos/etcd-backup")
      --bucket string       oss bucketName to save snapshot
      --docker              snapshot your kubernets etcd in container, will add unix timestamp to snapshot name
      --ep string           aliyun endpoints to save snapshot
  -h, --help                help for save
      --name string         Specify snapshot name (default "snapshot")
      --objectPath string   aliyun oss objectPath to save snapshot, like: /sealos/snapshots/
```

说明一下选项

- `--aliId`:  阿里云的`accessKeyId` 
- `--aliKey`: 阿里云的`accessKeySecrets`
- `--backupPath`:  在执行sealos的主机以及master主机上的备份路径. 默认为`/opt/sealos/etcd-backup`
- `--bucket`: 阿里云的`oss bucketName`
- `--ep`: 阿里云`oss endpoint`. 例如: `oss-cn-hangzhou.aliyuncs.com`
- `--name`: 备份文件的名字, 默认为`snapshot`
- `--objectPath`: 阿里云`oss objectPath`. 例如:  `/sealos/snapshots/`

这里, 上传阿里云oss. 使用命令行或者编辑配置文件均可.

```
$ sealos etcd save --docker \
    --aliId youraliyunkeyid \
    --aliKey youraliyunkeysecrets \
    --ep oss-cn-hangzhou.aliyuncs.com  \
    --bucket etcdbackup  \
    --objectPath /sealos/ 
```

或者使用`vim` 编辑 `.sealos/config.yaml `文件. 均可

```
$ cat .sealos/config.yaml 
masters:
- 192.168.0.31:22
nodes:
- 192.168.0.30:22
- 192.168.0.88:22
- 192.168.0.65:22
dnsdomain: cluster.local
apiservercertsans:
- 127.0.0.1
- apiserver.cluster.local
- 192.168.0.31
- 10.103.97.2
user: root
passwd: ""
privatekey: /root/.ssh/id_rsa
pkpassword: ""
apiserverdomain: apiserver.cluster.local
vip: 10.103.97.2
pkgurl: /root/kube1.18.0.tar.gz
version: v1.18.0
repo: k8s.gcr.io
podcidr: 100.64.0.0/10
svccidr: 10.96.0.0/12
certpath: /root/.sealos/pki
certetcdpath: /root/.sealos/pki/etcd
lvscarename: fanux/lvscare
lvscaretag: latest
alioss:
  ossendpoint: oss-cn-hangzhou.aliyuncs.com
  accesskeyid: *****
  accesskeysecrets: ****
  bucketname: etcdbackup
  objectpath: /sealos/
```

### 在`kubernetes `使用`cronjob`备份

依赖 `~/.sealos/config.yaml`
依赖 `etcd cacert，cert， key`， 目前读取的文件是 `~/.sealos/pki/etcd/`的证书。

首先. 只需要挂载`~/.sealos/`到容器`~/.sealos/`.   挂载这个目录的目的是， 使用其中四个文件. 给四个文件创建`secret`感觉有点臃肿. 故而采用目录挂载.  我们假设`master-01`是您执行`sealos init`的主机. 

>  如果在集群外执行`init`. 请使用`scp`. 例如`scp -rf ~/.sealos master-01:/root/`.

```
$ kubectl label nodes master-01  name=sealos --overwrite
```

如果你通过ssh连接到各master的方式如果为秘钥验证, 则需要添加一个`secret`保存秘钥即可.  为了安全，我这边使用在`kube-system`中创建的。

```
$ kubectl create secret generic pk-sealos --from-file=/root/.ssh/id_rsa  -n kube-system
```

我们编辑`crontjob.yaml`

```
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: backup-etcd
  namespace: kube-system   ## you can change to any namespace
spec: #当没有指定pod选择器时它将根据pod模板中的标签创建
  schedule: "0 21 * * *"  # backup everyday on 21：00
  successfulJobsHistoryLimit: 3
  jobTemplate: #创建新pod所使用的pod模板
    spec:
      template: # 此CronJob创建Job资源会用到的模板
        spec:
          restartPolicy: OnFailure  # Job不能使用Always作为默认的重新启动策略
          nodeSelector:
            name: sealos    ## this is your sealos init machine. so we can use hostPath.
          volumes:
          - hostPath:
              path: /root/.sealos
              type: DirectoryOrCreate
            name: sealos-home
          # if use password to auth, just remove this secret
          # before use secret, you must create it.
          - secret:
              defaultMode: 420
              items:
                - key: id_rsa
                  path: id_rsa
              secretName: pk-sealos
            name: pk-sealos
          containers:
          - name: sealos
            image: louisehong/sealos:3.3.10
            args:
              - etcd
              - save
              - --docker
            volumeMounts:
              - mountPath: /root/.sealos
                name: sealos-home
              # if use password to auth, just remove this volumeMounts
              - mountPath: /root/.ssh/id_rsa
                name: pk-sealos
                subPath: id_rsa
```

然后执行`apply`即可.

```
$ kubectl apply -f crontjob.yaml
$ kubectl get cronjobs.batch -n kube-system 
NAME          SCHEDULE     SUSPEND   ACTIVE   LAST SCHEDULE   AGE
backup-etcd   0 21 * * *   False     0        20h             9d
```

备份后, 可以查看具体的日志. 

```
$ $ kubectl get pods -n kube-system| grep backup
backup-etcd-1598662800-69sbh               0/1     Completed   0          2d8h
backup-etcd-1598706000-vwhpz               0/1     Completed   0          44h
backup-etcd-1598792400-m5z5z               0/1     Completed   0          20h
$ kubectl logs -f backup-etcd-1598792400-m5z5z -n kube-system
...
13:00:12 [INFO] [etcd_save.go:120] Finished saving/uploading snapshot [snapshot-1598792407] on aliyun oss [etcdbackup] bucket
13:00:12 [INFO] [etcd.go:111] Finished saving/uploading snapshot [snapshot-1598792407]
13:00:12 [INFO] [etcd_save.go:259] health check for etcd: [{192.168.0.31:2379 true 18.571896ms }]
```

## 使用`sealos etcd health`

很简单的调用`etcd clientv3`的sdk. 执行健康检查. 每次 `save` 也会进行健康检查. 

```
$ sealos etcd health
17:14:06 [INFO] [etcd_save.go:255] health check for etcd: [{192.168.0.31:2379 true 10.493436ms }]
```

## 使用`sealos etcd restore`

`restore`的逻辑是(如果有高手有好的恢复逻辑, 请单独联系我): 

1. 手动交互确认. 如果使用了`-f 或者 --force` 则跳过确认.
2.  通过`save`下来的文件, 进行`restore`操作. 会在执行`sealos etcd restore`的主机下生成目录`restorePath + hostname`.  
3. 停止 `kubernetes kube-apiserver kube-controller-manager kube-scheduler etcd  `. 并备份`/var/lib/etcd/`
4. 将2生成的备份目录打包成`tar`包, 复制到各`etcd`节点(一般是`master`节点).  然后在各节点分别解压到` /var/lib/etcd `.
5. 启动`kubernetes kube-apiserver kube-controller-manager kube-scheduler etcd`
6. 最后做一次健康检查(60s). 
7. 如果其中有错误发生. 则恢复3步骤的备份. 

```
$ sealos etcd restore -h
Restores an etcd member snapshot to an etcd directory

Usage:
  sealos etcd restore [flags]

Flags:
      --backupPath string    Specify snapshot backup dir (default "/opt/sealos/etcd-backup")
  -f, --force                restore need interactive to confirm
  -h, --help                 help for restore
      --name string          Specify snapshot name (default "snapshot")
      --restorePath string   Specify snapshot restore dir (default "/opt/sealos/etcd-restore")

Global Flags:
      --config string   config file (default is $HOME/.sealos/config.yaml)
```

与`sealos save` 相反的操作.  但是此操作比较危险.  所以添加了交互确认. 

选项说明

- `--backupPath`:  存储备份的文件夹. 默认和`save`下来的一致, `/opt/sealos/etcd-backup`

- `--restorePath`:  恢复文件夹. 默认`/opt/sealos/etcd-restore`. 配合主机名. 避免多`master`导致恢复文件夹重复. 
- `-f, --force`:  交互式确认是否要执行restore.
- `--name`:  备份的文件名字. 默认和`save`下来的一致. `snapshot`

### 单机测试restore恢复

如下: 

```
/* Detailed source-code truncated for AI context efficiency. */
```

---

### Archived 3.0 Command Exec (`docs/archived/3.0/command/exec.md`)

# `sealos exec` 命令

>  支持在指定节点执行自定义命令, 拷贝一个文件到一些指定节点

如在所有master节点创建一个目录

```
sealos exec --cmd "mkdir /data" --label node-role.kubernetes.io/master=""
sealos exec --cmd "mkdir /data" --node x.x.x.x
sealos exec --cmd "mkdir /data" --node dev-k8s-mater 
```

拷贝一个文件到一些指定节点

```
sealos exec --src /data/foo --dst /root/foo --label node-role.kubernetes.io/master=""
sealos exec --src /data/foo --dst /root/foo --node x.x.x.x
sealos exec --src /data/foo --dst /root/foo --node dev-k8s-mater 
```

## 实现方法

### 获取待执行的`ip`序列逻辑

 将 `--label , --node hostname` 所关联的对象全部转为`ip`, 以`ip`为基点去执行`copy`或者是`cmd`. 

使用`ListOptions`, 通过`labelSelector`直接定位到相关的`nodeList`节点. 如果`label`为空, 则返回空. 如果不为空, 则返回的`ip` 加入到待执行的`ip`序列. 

```
func GetNodeListByLabel(k8sClient *kubernetes.Clientset, label string) (*v1.NodeList, error) {
	listOption := &metav1.ListOptions{LabelSelector: label}
	return k8sClient.CoreV1().Nodes().List(context.TODO(), *listOption)
}
func GetNodeIpByLabel(k8sClient *kubernetes.Clientset, label string) ([]string, error) {
	var ips []string
	if label == "" {
		return ips, nil
	}
	nodes, err := GetNodeListByLabel(k8sClient, label)
	if err != nil {
		return nil, err
	}
	for _, node := range nodes.Items {
		for _, v := range node.Status.Addresses {
			if v.Type == v1.NodeInternalIP {
				ips = append(ips, v.Address)
			}
		}
	}
	if len(ips) != 0 {
		return ips, nil
	}
	return nil, fmt.Errorf("label %s is not fount in kubernetes nodes", label)
}
```

将 `--node` 进行区分, 如果是`ip` ,则加入执行`ip`序列, 如果是`hostname`, 则加入到`hostname`序列, 通过使用Get方法, 获取K8s的ClientSet资源对象.通过`nodename`直接找到定位到node节点. 在通过一次`for loop` 找到`hostname`对应的`ip`, 将得到的`ip`加入到待执行的`ip`序列.

```
node, err := k8sClient.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})

for _, node := range resHost {
	ip, err := GetNodeIpByName(k8sClient, node)
	if err == nil {
		ips = append(ips, ip)
	}
}
```

这里对`ips`没有进行过滤. 只要满足是ipv4, 即加入到执行序列, 没有对`master ips`及`nodes ips`进行比对. 

```
// 集群 
k8s-master    192.168.0.31
huohua-test   192.168.0.30
server65      192.168.0.65
server88-new  192.168.0.88

// sealos exec --cmd "hostname"  --node 192.168.0.21 
// 192.168.0.21 is not in your kubernetes. but if your ssh access 192.168.0.21. the command will be exec in 192.168.0.21.  
```

### 执行命令逻辑

判断是执行`copy` 或者是 `cmd`方法如下. 如果两者都存在, 则先执行`copy`逻辑, 再执行`cmd`逻辑.

```
type ExecFlag struct {
	Dst      string
	Src      string
	Cmd      string
	Label    string
	ExecNode []string
	SealConfig
}

func (e *ExecFlag) IsUseCopy() bool {
	return FileExist(e.Src) && e.Dst != ""
}

func (e *ExecFlag) IsUseCmd() bool {
	return e.Cmd != ""
}
```

### 远程命令和复制实现

实现`scp`复制, 则是通过复制单个文件, 然后递归复制即可. 查看具体的[源码](https://github.com/labring/sealos/blob/master/pkg/sshcmd/sshutil/scp.go)
如果`--dst`在目标机器存在, 则不执行copy动作, 直接就跳过了. 

// todo
这里是否需要添加一个flag, 比如`--force, -f`, 直接覆盖? 或者先删除再复制?

```
// CopyLocalToRemote is copy file or dir to remotePath
func (ss *SSH) CopyLocalToRemote(host, localPath, remotePath string) {

}
// ssh session is a problem, 复用ssh链接
func (ss *SSH) copyLocalDirToRemote(sftpClient *sftp.Client, localPath, remotePath string) {

}
// solve the session
func (ss *SSH) copyLocalFileToRemote(sftpClient *sftp.Client, localPath, remotePath string) {

}
```

实现执行命令的逻辑. 这里是用的ssh. 具体不赘述.

## 使用方法

```
$ ./sealos exec -h
support exec cmd or copy file by Label/nodes

Usage:
  sealos exec [flags]

Examples:

	# exec cmd by label or nodes.  when --label and --node is Exist, get Union of both.
	sealos exec --cmd "mkdir /data" --label node-role.kubernetes.io/master= --node 192.168.0.2
	sealos exec --cmd "mkdir /data" --node 192.168.0.2 --nodes dev-k8s-mater
	
	# exec copy src file to dst by label or nodes. when --label and --node is Exist, get Union of both.
	sealos exec --src /data/foo --dst /root/foo --label node-role.kubernetes.io/master=""
	sealos exec --src /data/foo --dst /root/foo --node 192.168.0.2


Flags:
      --cmd string     exec command string
      --dst string     dest file location
  -h, --help           help for exec
      --label string   kubernetes labels like node-role.kubernetes.io/master=
      --node strings   node ip or hostname in kubernetes
      --src string     source file location

Global Flags:
      --config string   config file (default is $HOME/.sealos/config.yaml)
```

选项说明: 

- `--cmd`:  执行的命令.
- `--src`: 本地文件路径, 可以使文件或者是文件夹, 配合`--dst`使用.
- `--dst`: 目标文件路径, 配合`--src`使用.
- `--label`: `kubernetes`集群的`label`. 支持`label`逻辑表达式, 如 `kubernetes.io/arch!=amd64` 
- `--node`: 节点的`ip`或者是`hostname`

## 测试相关

集群如下

```
$ kubectl get nodes --show-labels
NAME           STATUS   ROLES    AGE   VERSION   LABELS
huohua-test    Ready    <none>   93d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=huohua-test,kubernetes.io/os=linux,name=huohua
k8s-master     Ready    master   93d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/master=
server65       Ready    <none>   89d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=server65,kubernetes.io/os=linux
server88-new   Ready    <none>   90d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=server88-new,kubernetes.io/os=linux,name=front
```

#### 仅使用 `--label` 执行 `cmd` 命令

<details><summary><code>1. Use --label to exec cmd </code> Output</summary><br><pre>
$ ./sealos exec --cmd "hostname "  --label beta.kubernetes.io/arch=amd64  
19:09:35 [INFO] [ssh.go:57] [ssh][192.168.0.88] cd /tmp && hostname 
19:09:35 [INFO] [ssh.go:57] [ssh][192.168.0.31] cd /tmp && hostname 
19:09:35 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && hostname 
19:09:35 [INFO] [ssh.go:57] [ssh][192.168.0.65] cd /tmp && hostname 
19:09:35 [INFO] [ssh.go:50] [192.168.0.88] server88-new
19:09:35 [INFO] [ssh.go:50] [192.168.0.30] huohua-test
19:09:35 [INFO] [ssh.go:50] [192.168.0.65] server65
19:09:36 [INFO] [ssh.go:50] [192.168.0.31] k8s-master
</pre></details>

#### 仅使用 `--node` 执行 `cmd` 命令

<details><summary><code>2. Use --node to exec cmd </code> Output</summary><br><pre>
$ ./sealos exec --cmd "hostname -i"  --node huohua-test --node 192.168.0.65 
19:20:47 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && hostname -i
19:20:47 [INFO] [ssh.go:57] [ssh][192.168.0.65] cd /tmp && hostname -i
19:20:47 [INFO] [ssh.go:50] [192.168.0.30] 192.168.0.30
19:20:47 [INFO] [ssh.go:50] [192.168.0.65] 192.168.0.65
</pre></details>

#### 使用 `--label` 和 `--node`执行 `cmd` 命令

<details><summary><code>3. Use --node & --label  to exec cmd  </code> Output</summary><br><pre>
$ ./sealos exec --cmd "hostname -i"  --node huohua-test  --label node-role.kubernetes.io/master=  
19:21:44 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && hostname -i
19:21:44 [INFO] [ssh.go:57] [ssh][192.168.0.31] cd /tmp && hostname -i
19:21:44 [INFO] [ssh.go:50] [192.168.0.30] 192.168.0.30
19:21:45 [INFO] [ssh.go:50] [192.168.0.31] 192.168.0.31
</pre></details>

#### 使用 `--label` 和 `--node`执行 `cmd` 命令和 复制文件

<details><summary><code>4. Use --node & --label  to exec cmd & copy files  </code> Output</summary><br><pre>
$ ./sealos exec --cmd "ls -lh /data/01.txt" --src /root/01.txt --dst /data/01.txt  --node huohua-test  --label node-role.kubernetes.io/master=  
19:23:01 [INFO] [ssh.go:12] [ssh][192.168.0.30] ls -l /data/01.txt 2>/dev/null |wc -l
19:23:01 [INFO] [ssh.go:12] [ssh][192.168.0.31] ls -l /data/01.txt 2>/dev/null |wc -l
19:23:01 [DEBG] [ssh.go:24] [ssh][192.168.0.30]command result is: 0
19:23:02 [INFO] [scp.go:328] [ssh]transfer [/root/01.txt] total size is: 2.11MB ;speed is 2MB
19:23:02 [DEBG] [ssh.go:24] [ssh][192.168.0.31]command result is: 0
19:23:02 [INFO] [scp.go:328] [ssh]transfer [/root/01.txt] total size is: 2.11MB ;speed is 2MB
19:23:02 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && ls -lh /data/01.txt
19:23:02 [INFO] [ssh.go:57] [ssh][192.168.0.31] cd /tmp && ls -lh /data/01.txt
19:23:02 [INFO] [ssh.go:50] [192.168.0.30] -rw-r--r-- 1 root root 2.2M 9月   4 19:23 /data/01.txt
19:23:03 [INFO] [ssh.go:50] [192.168.0.31] -rw-r--r--. 1 root root 2.2M Sep  4 19:23 /data/01.txt
</pre></details>

#### 使用 `--label` 和 `--node`执行 `cmd` 命令和 复制文件夹

<details><summary><code>5. Use --node & --label  to exec cmd & copy dir  </code> Output</summary><br><pre>
$ ./sealos exec --cmd "ls -lh /data/test" --src /root/test --dst /data/test  --node huohua-test  --label node-role.kubernetes.io/master=  
19:24:24 [INFO] [ssh.go:12] [ssh][192.168.0.30] ls -l /data/test 2>/dev/null |wc -l
19:24:24 [INFO] [ssh.go:12] [ssh][192.168.0.31] ls -l /data/test 2>/dev/null |wc -l
19:24:24 [DEBG] [ssh.go:24] [ssh][192.168.0.30]command result is: 0
19:24:24 [INFO] [scp.go:328] [ssh]transfer [/root/test/crontab.yaml] total size is: 1.19KB ;speed is 1KB
19:24:24 [INFO] [scp.go:328] [ssh]transfer [/root/test/crontab.yaml.bak] total size is: 2.23KB ;speed is 2KB
19:24:24 [DEBG] [ssh.go:24] [ssh][192.168.0.31]command result is: 0
19:24:25 [INFO] [scp.go:328] [ssh]transfer [/root/test/crontab.yaml] total size is: 1.19KB ;speed is 1KB
19:24:25 [INFO] [scp.go:328] [ssh]transfer [/root/test/crontab.yaml.bak] total size is: 2.23KB ;speed is 2KB
19:24:25 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && ls -lh /data/test
19:24:25 [INFO] [ssh.go:57] [ssh][192.168.0.31] cd /tmp && ls -lh /data/test
19:24:25 [INFO] [ssh.go:50] [192.168.0.30] 总用量 8.0K
19:24:25 [INFO] [ssh.go:50] [192.168.0.30] -rw-r--r-- 1 root root 1.2K 9月   4 19:24 crontab.yaml
19:24:25 [INFO] [ssh.go:50] [192.168.0.31] total 8.0K
</pre></details>

#### 使用 `--label`时,  `label` 不存在

<details><summary><code>6. Use --label if label not exist  </code> Output</summary><br><pre>
$ ./sealos exec --cmd "hostname -i"  --node huohua-test  --label node-role.kubernete.
12:48:25 [EROR] [exec.go:53] get ips err:  unable to parse requirement: invalid label key "node-role.kubernete.": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')
$ ./sealos exec --cmd "hostname -i"  --node huohua-test  --label node-role.kubernete               
12:48:42 [EROR] [exec.go:53] get ips err:  label node-role.kubernete is not fount in kubernetes nodes
</pre></details>

#### 使用 `--node`时,  `node`不存在

<details><summary><code>7. Use --node if node  not exist in kuernetes  </code> Output</summary><br><pre>
12:50:05 [INFO] [ssh.go:50] [192.168.0.88] server88-new
12:50:05 [INFO] [ssh.go:50] [192.168.0.30] huohua-test
12:50:05 [INFO] [ssh.go:50] [192.168.0.65] server65
12:50:05 [INFO] [ssh.go:50] [192.168.0.31] k8s-master
## this will output nothing   
$ ./sealos exec --cmd "hostname -i"  --node huohua-test031
## only exec on exsit nodes.
./sealos exec --cmd "hostname -i"  --node huohua-test031 --node 192.168.0.65
12:51:28 [INFO] [ssh.go:57] [ssh][192.168.0.65] cd /tmp && hostname -i
12:51:29 [INFO] [ssh.go:50] [192.168.0.65] 192.168.0.65
## when nodes ip is format but is not in kubernetes, will appear ssh session error , timeout. 
$ ./sealos exec --cmd "hostname -i"  --node huohua-test031 --node 192.168.9.65
12:52:14 [INFO] [ssh.go:57] [ssh][192.168.9.65] cd /tmp && hostname -i
12:53:14 [EROR] [ssh.go:60] [ssh][192.168.9.65]Error create ssh session failed,dial tcp 192.168.9.65:22: i/o timeout
</pre></details>

#### 支持`kubernetes label`的逻辑表达式. 

<details><summary><code>8. support kubernetes label exp like kubernetes.io/arch!=amd64  </code> Output</summary><br><pre>
$ kubectl get nodes --show-labels
NAME           STATUS   ROLES    AGE   VERSION   LABELS
huohua-test    Ready    <none>   93d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=huohua-test,kubernetes.io/os=linux,name=huohua
k8s-master     Ready    master   93d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/master=
server65       Ready    <none>   89d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=server65,kubernetes.io/os=linux
server88-new   Ready    <none>   89d   v1.18.3   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=server88-new,kubernetes.io/os=linux,name=front
$ ./sealos exec --cmd  "hostname -i"  --label name!=front 
09:17:21 [INFO] [ssh.go:57] [ssh][192.168.0.65] cd /tmp && hostname -i
09:17:21 [INFO] [ssh.go:57] [ssh][192.168.0.30] cd /tmp && hostname -i
09:17:21 [INFO] [ssh.go:57] [ssh][192.168.0.31] cd /tmp && hostname -i
09:17:21 [INFO] [ssh.go:50] [192.168.0.30] 192.168.0.30
09:17:21 [INFO] [ssh.go:50] [192.168.0.65] 192.168.0.65
09:17:21 [INFO] [ssh.go:50] [192.168.0.31] 192.168.0.31
</pre></details>

---

### Archived 3.0 Command Route (`docs/archived/3.0/command/route.md`)

# `sealos route` 命令

## 使用`sealos route`

> 这个命令产生的原因， 是在双网卡甚至多网卡的主机上， 使用`sealos init`安装 `kubernetes` 集群失败。
> 
> kubernetes 集群在使用`kubeadm init`安装的时候，会读取默认路由条目下的ip作为 `apiserver-advertise-address`和`etcd`的`advertise-address`
>
> 使用`localAPIEndpoint`来定义即可。  lvscare了创建 ipvs 在多网卡的情况下， 
> node节点但是得添加一个 `10.103.97.2`到非默认路由 ip的 一个路由. 不然ipvs 不通
>
> 对比目前ip和默认路由ip， 来判断是否需要进行添加路由操作。

```
$ sealos route -h
set route gateway

Usage:
  sealos route [flags]
  sealos route [command]

Available Commands:
  add         set route host via gateway, like ip route add host via gateway
  del         del route host via gateway, like ip route del host via gateway

Flags:
  -h, --help          help for route
      --host string   route host ip address for iFace

Global Flags:
      --config string   config file (default is $HOME/.sealos/config.yaml)

Use "sealos route [command] --help" for more information about a command.
```

说明一下选项

`sealos route --host` : 根据这个`--host ip`来比对当前的默认路由所绑定的`default ip`，来进行判断是否是默认路由的ip。


like linux command `ip route add host via gateway`

- `sealos route add --gateway --host`: 主机上的路由gateway ip， 如 `192.168.0.1`， 目标地址的host`192.168.0.23`，  这个gateway将通过`host`添加到路由条目，


like linux command `ip route del host via gateway`

- `sealos route del --gateway --host`: 主机上的路由gateway ip， 如 `192.168.0.1`， 目标地址的host`192.168.0.23`， 将匹配这条路由删除掉。
### 演示

演示主机默认路由为 `192.168.253.1` 。

名称|网卡1|网卡2
---|---|---
ip|192.168.160.243|192.168.253.129
路由|192.168.160.1|192.168.253.1


use `--host` to check default route gateway, only support ipv4

根据这个`--host ip`来比对当前的默认路由所绑定的`default ip`， 

```
$ sealos route --host 192.168.253.129
  ok
$ sealos route --host 192.168.253.128
  failed
$ sealos route --host 192.168.160.243
  failed
```

use `add --gateway  --host ` to set default route gateway, only support ipv4

```
$ sealos route add --host 10.103.97.2 --gateway 192.168.253.129
$ ip route show |grep 10.103.97.2
10.103.97.2 via 192.168.253.129 dev ens32 

## show nothing. when no error
$ sealos route del --host 10.103.97.2 --gateway 192.168.253.129
$ ip route show |grep 10.103.97.2

## exec twice
$ sealos route del --host 10.103.97.2 --gateway 192.168.253.129
delRouteGatewayViaHost err:  no such process
```

## 实现原理

通过和默认的路由条目进行比对. 使用 "github.com/vishvananda/netlink"命令操作`linux`主机默认路由。 


获取默认路由`ip`， 使用的是`"k8s.io/apimachinery/pkg/util/net"`这个包里面的` ChooseHostInterface()`来获取.
像`apiserver`和`etcd`的`advertise-address`都是这个方法获取。 目前只支持ipv4.

```go
func (r *RouteFlags) useHostCheckRoute() bool {
	return k8s.IsIpv4(r.Host) && r.Gateway ==""
}

func (r *RouteFlags) useGatewayManageRoute() bool {
	return k8s.IsIpv4(r.Gateway) && k8s.IsIpv4(r.Host)
}



// getDefaultRouteIp is get host ip by ChooseHostInterface() .
func getDefaultRouteIp() (ip string, err error) {
	netIp, err := k8snet.ChooseHostInterface()
	if err != nil {
		return "", err
	}
	return netIp.String(), nil
}
```

具体详情请查看源码`"github.com/labring/sealos/install/route.go"`

### 配合和`sealos init`使用

这里简要描述一下init逻辑： 

1. check ， 检查主机名是否重复
2. sendSealos, 将最新的sealos复制到 /usr/bin/ 
3. sendPackage， 将压缩kube1.**.tar.gz包复制到各主机
4. KubeadmConfigInstall, 生成`kubeadm-config`
5. GenerateCert, 生成`pki`证书
6. CreateKubeconfig, 生成`kube-×.config`文件
7. InstallMaster0, 安装第一个`master`节点。 
8. 安装其他子节点。 优先`master`， 再`node` 。

    8.1 安装master， 采用`kubeadm join --config=/root/kubeadm-join-config.yaml`
    
    8.2 安装node节点，对当前的网卡进行判断， 如果是单网卡跳过， 如果是多网卡， 且安装的node ip 不是本机的默认路由ip， 
    添加一条路由 例如`ip route add 10.103.97.2 via node ip`

所以， 当存在双网卡的时候，且init指定的node ip 不是默认路由所在的网卡ip， 在node节点。我们只需要在8.2的时候， 添加一条从`vip`到`node ip`的路由即可。

```go
// 如果不是默认路由， 则添加 vip 到 master的路由。
	cmdRoute := fmt.Sprintf("sealos route --host %s", IpFormat(node))
	status := SSHConfig.CmdToString(node, cmdRoute, "")
	if status != "ok" {
		// 以自己的ip作为路由网关
		addRouteCmd := fmt.Sprintf("sealos route add --host %s --gateway %s", VIP, IpFormat(node))
		SSHConfig.CmdToString(node, addRouteCmd, "")
	}
```

---

### Archived 3.0 Command Upgrade (`docs/archived/3.0/command/upgrade.md`)

# `sealos upgrade` 命令

## 使用`sealos upgrade`

> 这个命令产生的原因， kubernetes 版本变化太快， 老版本对新版本的切换需求还是蛮大的。 使用 `sealos` 一键安装完集群后。
> 自然就需要对集群的升级做维护，目前 `sealos` 的底层安装是使用 `kubeadm` 来进行安装的， 因此，整个升级过程也是按照 `kubeadm` 的升级逻辑来设计的。

如果需要手动升级， 详细查看并理解[kubeadm官方升级](https://kubernetes.io/zh/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/)

将 `sealos` 创建的 `Kubernetes` 集群从 `1.a.x` 版本升级到 `1.b.x` 版本， 或者从版本 `1.b.x` 升级到 `1.b.y` ，其中 `y > x`,  `a+1=b`。

升级的流程如下：

1. 复制`1.b.y`版本的相关的压缩包到各节点， 解压， 并替换相应的二进制文件, 导入镜像.
2. 升级`master0`节点.
3. `waitgroup`并发升级`othermaster`节点.
4. `waitgroup`并发升级`worker`节点.

### 命令解析

```shell
$ sealos  upgrade -h
upgrade your kubernetes version by sealos

Usage:
  sealos upgrade [flags]

Flags:
  -f, --force            upgrade need interactive to confirm
  -h, --help             help for upgrade
      --pkg-url string   http://store.lameleg.com/kube1.14.1.tar.gz download offline package url, or file location ex. /root/kube1.14.1.tar.gz
      --version string   upgrade version for kubernetes version
```

- `--force` : 升级集群需要用户交互确认。 
- `--pkg-url`: `sealos`的专门的离线安装包。 如`ube1.18.3.tar.gz`
- `--version`:  `kubernetes` 的版本号， 和`pkg-url`对应， 如`v1.18.3`。

## 实现原理

升级第一个控制面节点.

```shell
$ kubeadm upgrade apply v1.18.x
```

升级其他控制面板和工作节点。

```shell
$ kubeadm upgrade node
```

## 升级前注意

- 你目前的集群是否健康? 

`kubectl get nodes -owide`查看集群状态. 当你想要通过`sealos upgrade`升级时, 必须保证集群是正常运行的.

- `kube-system`下的`pod`是否运行正常? 

`kubectl get pod -n kube-system -owide` , 查看正在运行的pod状态. 保证正常运行.

- kubernetes的node节点的名称和该节点的`hostname`是否一样? 

node name 和 hostname 必须保证一样. 否则会升级失败. 

## 实际操作开始

- 你需要有一个由 `sealos` 创建并运行着 1.15.+ 或更高版本的 `Kubernetes` 集群。
- 集群应使用静态的控制平面和 `etcd Pod` 或者 外部 `etcd`。
- 务必备份所有重要组件，例如存储在数据库中应用层面的状态。 `sealos upgrade` 不会影响你的工作负载，只会涉及 `Kubernetes` 内部的组件，但备份终究是放心一点。

### 附加信息

- 所有的容器都会重启， 因为容器的`spec hash` 发生了变化
- 你只能从一个次版本升级到下一个次版本，或者在次版本相同时升级补丁版本。 也就是说，升级时不可以跳过次版本。 例如，你只能从 1.y 升级到 1.y+1，而不能从 1.y 升级到 1.y+2。

### 确定升级版本

去[官网](https://www.sealyun.com/goodsList)上寻找你想要部署的版本比如 `1.19.2` 。 因此你的版本必须要大于等于`1.18.0`，方可升级.

1主1从，目前版本是v1.18.3 ,需要升级至 v1.19.2. sealos 可以升级

<details><summary><code>upgrade logs </code> Output</summary><br><pre>

```
/* Detailed source-code truncated for AI context efficiency. */
```

</pre></details>

### 验证集群状态

在所有节点上升级 `kubelet` 后，通过从 `kubectl` 可以访问集群的任何位置运行以下命令，验证所有节点是否再次可用：

```shell
$ kubectl get nodes
NAME             STATUS   ROLES    AGE   VERSION
dev-k8s-master   Ready    master   13h   v1.19.2
dev-k8s-node     Ready    <none>   13h   v1.19.2
$ kubectl get pod -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-688c5dc8c7-ds9jx   1/1     Running   0          2m51s
kube-system   calico-node-7vsvh                          1/1     Running   1          13h
kube-system   calico-node-q5x7v                          1/1     Running   0          13h
kube-system   coredns-f9fd979d6-9xpfx                    1/1     Running   0          2m51s
kube-system   coredns-f9fd979d6-bnk5c                    1/1     Running   0          2m51s
kube-system   etcd-dev-k8s-master                        1/1     Running   0          3m21s
kube-system   kube-apiserver-dev-k8s-master              1/1     Running   0          3m27s
kube-system   kube-controller-manager-dev-k8s-master     1/1     Running   0          3m27s
kube-system   kube-proxy-2js4v                           1/1     Running   0          2m32s
kube-system   kube-proxy-k4jj6                           1/1     Running   0          2m38s
kube-system   kube-scheduler-dev-k8s-master              1/1     Running   0          3m22s
kube-system   kube-sealyun-lvscare-dev-k8s-node          1/1     Running   0          3m3s
```

`STATUS` 应显示所有节点为 `Ready` 状态，并且版本号已经被更新。

### 更多升级示例

详细查看这个[pr](https://github.com/labring/sealos/pull/481)

## 从故障状态恢复

如果 `sealos upgrade` 失败并且没有回滚，例如由于执行期间意外关闭，你可以再次运行 `sealos upgrade`。 此命令是幂等的，并最终确保实际状态是你声明的所需状态。 要从故障状态恢复，你还可以运行 `kubeadm upgrade --force` 而不去更改集群正在运行的版本。

在升级期间，`kubeadm` 向 `/etc/kubernetes/tmp` 目录下的如下备份文件夹写入数据：

- `kubeadm-backup-etcd-<date>-<time>`
- `kubeadm-backup-manifests-<date>-<time>`

`kubeadm-backup-etcd` 包含当前控制面节点本地 etcd 成员数据的备份。 如果 etcd 升级失败并且自动回滚也无法修复，则可以将此文件夹中的内容复制到 `/var/lib/etcd` 进行手工修复。如果使用的是外部的 etcd，则此备份文件夹为空。

`kubeadm-backup-manifests` 包含当前控制面节点的静态 Pod 清单文件的备份版本。 如果升级失败并且无法自动回滚，则此文件夹中的内容可以复制到 `/etc/kubernetes/manifests` 目录实现手工恢复。 如果由于某些原因，在升级前后某个组件的清单未发生变化，则 `kubeadm` 也不会为之 生成备份版本。

## `kubeadm apply`工作原理

`kubeadm upgrade apply` 做了以下工作：

- 检查你的集群是否处于可升级状态:
  - API 服务器是可访问的
  - 所有节点处于 `Ready` 状态
  - 控制面是健康的
- 强制执行版本 skew 策略。
- 确保控制面的镜像是可用的或可拉取到服务器上。
- 升级控制面组件或回滚（如果其中任何一个组件无法启动）。
- 应用新的 `kube-dns` 和 `kube-proxy` 清单，并强制创建所有必需的 RBAC 规则。
- `sealos`创建集群证书有效期默认100年。 因此使用了 `--certificate-renewal=false`, 不用重新生成证书了。

`kubeadm upgrade node` 在其他控制平节点上执行以下操作：

- 从集群中获取 `kubeadm ClusterConfiguration`。
- 可选地备份 `kube-apiserver` 证书。
- 升级控制平面组件的静态 `Pod` 清单。
- 为本节点升级 `kubelet` 配置

`kubeadm upgrade node` 在工作节点上完成以下工作：

- 从集群取回 `kubeadm ClusterConfiguration`。
- 为本节点升级 `kubelet` 配置

---

### Archived 3.0 Design Design (`docs/archived/3.0/design/design.md`)

# 设计理念
## 概述与理念
sealos旨在做一个简单干净轻量级稳定的kubernetes安装工具，能很好的支持高可用安装。 其实把一个东西做的功能强大并不难，但是做到极简且灵活可扩展就比较难。

所以在实现时就必须要遵循这些原则。

sealos特性与优势：

* 支持离线安装，工具与资源包（二进制程序 配置文件 镜像 yaml文件等）分离,这样不同版本替换不同离线包即可
* 百年证书
* 使用简单
* 支持自定义配置
* 内核负载，极其稳定，因为简单所以排查问题也极其简单
* 不依赖ansible haproxy keepalived, 一个二进制工具，0依赖
* 资源包放在阿里云oss上，再也不用担心网速
* dashboard ingress prometheus等APP 同样离线打包，一键安装
* etcd一键备份(etcd原生api调用)。支持上传至oss，实现异地备份, 用户无需关心细节。

> 为什么不使用ansilbe

1.0版本确实是用ansible实现，但是用户还是需要先装ansible，装ansible有需要装python和一些依赖等，为了不让用户那么麻烦把ansible放到了容器里供用户使用。如果不想配置免密钥使用用户名密码时又需要ssh-pass等，总之不能让我满意，不是我想的极简。

所以我想就来一个二进制文件工具，没有任何依赖，文件分发与远程命令都通过调用sdk实现所以不依赖其它任何东西，总算让我这个有洁癖的人满意了。

> 为什么不用keepalived haproxy

haproxy用static pod跑没有太大问题还算好管理，keepalived现在大部分开源ansible脚本都用yum 或者apt等装，这样非常的不可控，有如下劣势：

* 源不一致可能导致版本不一致，版本不一直连配置文件都不一样，我曾经检测脚本不生效一直找不到原因，后来才知道是版本原因
* 系统原因安装不上，依赖库问题某些环境就直接装不上了
* 看了网上很多安装脚本，很多检测脚本与权重调节方式都不对，直接去检测haproxy进程在不在，其实是应该去检测apiserver是不是healthz的,api挂了即使haproxy在集群也会不正常了，就是伪高可用了。
* 管理不方便，通过prometheus对集群进行监控，是能直接监控到static pod的但是用systemd跑又需要单独设置监控，且重启啥的还需要单独拉起。不如kubelet统一管理来的干净简洁。
* 我们还出现过keepalived把CPU占满的情况。

所以为了解决这个问题，我把keepalived跑在了容器中(社区提供的镜像基本是不可用的) 改造中间也是发生过很多问题，最终好在解决了。

总而言之，累觉不爱，所以在想能不能甩开haproxy和keepalived做出更简单更可靠的方案出来，还真找到了。。。

> 本地负载为什么不使用envoy或者nginx

我们通过本地负载解决高可用问题

解释一下本地负载，就是在每个node节点上都启动一个负载均衡，上游就是三个master，负载方式有很多 ipvs envoy nginx等，我们最终使用内核ipvs

如果使用envoy等需要在每个节点上都跑一个进程，消耗更多资源，这是我不希望的。ipvs实际也多跑了一个进程lvscare，但是lvscare只是负责管理ipvs规则，和kube-proxy类似，真正的流量还是从很稳定的内核走的，不需要再把包走到用户态中去处理。

实现上有个问题会让使用envoy等变得非常尴尬，就是join时如果负载均衡没有建立那是会卡住的，kubelet就不会起，所以为此你需要先把envory起起来，意味着你又不能用static pod去管理它，同上面keepalived宿主机部署一样的问题，用static pod就会相互依赖，逻辑死锁，鸡说要先有蛋，蛋说要先有鸡，最后谁都没有。

使用ipvs就不一样，我可以在join之前先把ipvs规则建立好，再去join就可以join进去了，然后对规则进行守护即可。一旦apiserver不可访问了，会自动清理掉所有node上对应的ipvs规则， master恢复正常时添加回来。

# 设计原理

## 执行流程
* 在执行机器上生成证书和kubeconfig文件
* 在执行机器上wget下载离线包和sealos二进制使用scp拷贝到目标机器上（masters和nodes）
* 在master0上执行kubeadm init
* 在其它master上执行kubeadm join 并设置控制面，这个过程会在其它master上起etcd并与master0的etcd组成集群，并启动控制组建（apiserver controller等）
* join node节点，会在node上配置ipvs规则，配置/etc/hosts等

有个细节是所有对apiserver进行访问都是通过域名，因为master上连接自己就行，node需要通过虚拟ip链接多个master，这个每个节点的kubelet与kube-proxy访问apiserver的地址是不一样的，而kubeadm又只能在配置文件中指定一个地址，所以使用一个域名但是每个节点解析不同。

使用域名的好处还有就是IP地址发生变化时仅需要修改解析即可。

## 本地内核负载
通过这样的方式实现每个node上通过本地内核负载均衡访问masters：
```
  +----------+                       +---------------+  virturl server: 127.0.0.1:6443
  | mater0   |<----------------------| ipvs nodes    |    real servers:
  +----------+                      |+---------------+            10.103.97.200:6443
                                    |                             10.103.97.201:6443
  +----------+                      |                             10.103.97.202:6443
  | mater1   |<---------------------+
  +----------+                      |
                                    |
  +----------+                      |
  | mater2   |<---------------------+
  +----------+
```
在node上起了一个lvscare的static pod去守护这个 ipvs, 一旦apiserver不可访问了，会自动清理掉所有node上对应的ipvs规则， master恢复正常时添加回来。

所以在你的node上加了三个东西，可以直观的看到：
```bash
cat /etc/kubernetes/manifests   # 这下面增加了lvscare的static pod
ipvsadm -Ln                     # 可以看到创建的ipvs规则
cat /etc/hosts                  # 增加了虚拟IP的地址解析
```

**sealos已经把lvscare本地负载和百年证书已经在sealos中支持，使用起来极其方便！！！**


## 离线包结构分析
```
.
|____docker # docker的离线包
| |____docker.tgz
| |____README.md
|____bin # 指定版本的bin文件
| |____conntrack
| |____kubeadm
| |____kubelet
| |____kubelet-pre-start.sh
| |____kubectl
| |____crictl
|____images # kubernetes的离线镜像
| |____images.tar
| |____README.md
|____shell # 离线包的部署脚本,sealos会自动调用
| |____master.sh
| |____init.sh
| |____docker.sh
|____README.md
|____conf
| |____net   # 高版本的sealos已经集成
| | |____calico.yaml
| |____10-kubeadm.conf # kubeadm的配置文件
| |____calico.yaml
| |____kubeadm.yaml
| |____kubelet.service
| |____docker.servic
```
init.sh脚本中拷贝bin文件到$PATH下面，配置systemd，关闭swap防火墙等，然后导入集群所需要的镜像。

master.sh主要执行了kubeadm init

conf下面有有我需要的如kubeadm的配置文件，calico yaml文件等等

sealos会调用二者。 所以大部分兼容不同版本都可以微调脚本做到。

---

### Archived 3.0 History V2.0 (`docs/archived/3.0/history/v2.0.md`)

# play book支持

2.0 灵活性不够，很多时候修改功能需要修改代码，如果能支持playbook,大部分情况仅需要修改默认playbook即可。也可支持用户自定义playbook。

## 全局变量
```
$MASTER0
$MASTERS
$NODES
```
## 语法
```
- copy .tar.gz files
  scp:
    - kubernetes1.15.2.tar.gz /root/
  on:
   - master0
   - master
   - nodes

- init all nodes
  cmd: 
    - tar zxvf kubernetes1.15.2.tar.gz
    - cd shell 
    - sh init.sh
  on:                 # 表示在哪些节点上运行
    - master0         # 都是默认值
    - master
    - nodes

- init master0
  cmd:
    - cd shell
    - sh master.sh
  on:
    - master0
  output:
    $init-output

- get join master and nodes commands
  func:
    - $join-master=GET_JOIN_COMMAND($init-output)[0] # GET_JOIN_COMMAND是个特殊的函数，负责在输出中解析join命令
    - $join-nodes=GET_JOIN_COMMAND($init-output)[1]

- join masters
  cmd:
    - $join-master
  on:
    - masters

- join nodes
  cmd:
    - $join-nodes
  on:
    - nodes
```

---

### Archived 3.0 History V3.0 (`docs/archived/3.0/history/v3.0.md`)

# 3.0 设计文档

3.0 两个重要动作：

1. 剥离核心组件与上层app
2. app安装支持

# runtime cloud-kernel apps统一包格式
## runtime
```
docker.tar
   runtime.tar.gz # 包含所有镜像文件，yaml文件，配置文件脚本，具体是什么sealos不关心, .tar.gz不是必须，压缩只是为了记包更小
   config           # sealos install 配置文件
```
config 文件内容：
```
# LOAD会在sealos过滤出来的每个节点上执行
LOAD sh init.sh
# START会在sealos过滤出来的每个节点上执行
START systemctl start docker
# STOP会在sealos过滤出来的每个节点上执行
STOP systemctl stop docker
# REMOVE会在sealos过滤出来的每个节点上执行
REMOVE sh remove.sh
```

## cloud-kernel
```
cloud-kernel.tar
   kernel.tar.gz # 包含所有镜像文件，yaml文件，配置文件脚本，具体是什么sealos不关心 
   config           # sealos install 配置文件
```
安装过程特殊可以不统一

## APP
```$xslt
tar cvf dashboard.tar config dashboard.tar.gz
```
```
dashboard.tar
   dashboard.tar.gz # 包含所有镜像文件，yaml文件，配置文件脚本，具体是什么sealos不关心 
   config           # sealos install 配置文件
```

config 文件内容：
```
# APPLY指令只会在能访问apiserver的节点执行一次
APPLY kubectl apply -k manifests
# LOAD会在sealos过滤出来的每个节点上执行
LOAD docker load -i images.tar
# DELETE 命令只会在能访问apiserver节点执行一次
DELETE kubectl delete -k manifests
# 删除命令，sealos remove命令会调用
REMOVE docker rmi dashboard:2.0.0
```

指令说明：

指令 | 作用 | 事例 |在过滤出来的每个节点执行 | 只针对apiserver执行一次 
--- | ---| ---|---|---
LOAD | 如导入镜像 | docker load -i images.tar | ✓ |x
START | 如启动docker | systemctl start docker |✓ |x 
STOP | 如停止docker | systemctl stop docker | ✓ | x
REMOVE | 如清理镜像 | docker rmi -f ...| ✓ |x
APPLY | 如部署yaml文件 | kubectl apply -k . | x| ✓
DELETE | 如删除yaml | kubectl delete -f . | x |✓

# 安装
```$xslt
sealos install --pkg-url dashboard.tar --label role=master --cmd "APPLY kubectl apply -k manifests" --cmd "LOAD docker load -i images.tar"
```
* --pkg 支持本地与http
* --label 过滤出k8s集群中指定节点
* --cmd 会覆盖config中的指令

或者使用kustomize替换包内镜像版本
```
sealos install --pkg-url prometheus.tar --cmd \
        "APPLY kustomize edit set image sealyun/fist:1.0=sealyun/fist:2.0 && kubectl apply -k manifests"
```

## ~/.sealos/config.yaml

sealos init时把相关参数存入配置文件, 供执行clean, install命令使用

# dashboard 包制作示例

1. 创建工作目录

```cassandraql
mkdir dashboard && cd dashboard
```

2. 编辑配置文件

```cassandraql
echo "LOAD docker load -i image.tar" >> config
echo "APPLY kubectl apply -f dashboard.yaml" >> config
echo "DELETE kubectl delete -f dashboard.yaml" >> config
echo "REMOVE sleep 10 && docker rmi -f dashboard:latest" >> config
```

3. 下载yaml文件与保存镜像

```cassandraql
wget https://..../dashboard.yaml 
docker save -o image.tar dashboard:latest
```

4. 打包

```cassandraql
tar cvf dashboard.tar config dashboard.yaml image.tar
```

5. 安装使用

```cassandraql
sealos install --pkg-url ./dashboard.tar
```

---

### Archived 3.0 Plan Join Master Failed (`docs/archived/3.0/plan/join_master_failed.md`)

## sealos 安装3master, 由于不可预知原因, 宕机一台, 需要重新加入该master.

> 背景:  sealos init 3 台 master, 由于不可预知原因, 其中一台   `192.168.0.119`  断电宕机等不可避免因素. 重启后启动失败. 故考虑clean后, 再join到集群.

首先 `clean`
```
sealos clean --master 192.168.0.119 -f
```
其次 `join`,  join过程会出现 etcd 检查失败.
```
sealos join --master 192.168.0.119
... 
[check-etcd] Checking that the etcd cluster is healthy

error execution phase check-etcd: etcd cluster is not healthy: failed to dial endpoint https://192.168.0.119:2379 
with maintenance client: context deadline exceeded
...
```

## 解决方法

> 因为sealos 构建的高可用集群底层是通过 `kubeadm `工具搭建的，且使用了 etcd 镜像方式与 master 节点一起，所以每个 Master 节点上都会存在一个 etcd 容器实例。当剔除一个 master 节点时 etcd 集群未删除剔除的节点的 etcd 成员信息，该信息还存在 etcd 集群列表中。

// todo
优化:  这里是不是考虑clean的时候把 ectd 集群的member 也清理一下?

所以，我们需要手动删除 etcd 成员信息。

```
$ kubectl get pods -n kube-system | grep etcd
etcd-server501                                    1/1     Running   3          21d
etcd-ubuntu                                       1/1     Running   0         21d
$ kubectl exec -n kube-system  -it etcd-ubuntu -- sh
# export ETCDCTL_API=3
# alias etcdctl='etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key'

# etcdctl  member list
1bd1316c3c1a02a1, started, server501, https://192.168.0.25:2380, https://192.168.0.25:2379, false
2fe4b88491460ba0, started, server119, https://192.168.0.119:2380, https://192.168.0.119:2379, false
486e0511355102be, started, ubuntu, https://192.168.0.118:2380, https://192.168.0.118:2379, false

# etcdctl member remove 2fe4b88491460ba0
```

然后执行`clean &&  join`即可解决.

```
$ sealos clean --master 192.168.0.119 -f
$ sealos join --master 192.168.0.119
```

这里谢谢钉钉@毛徐飞提供相关环境.

---

### Archived 3.0 Plan Multi Network Install (`docs/archived/3.0/plan/multi_network_install.md`)

# 多网卡在sealos中的解决方案

## 情形一

> 有网络环境如下：每台服务器两张网卡，千兆网络直通互联网，名字ens33，默认路由走该网卡。
> 万兆网二层打通。网卡名字ens32。 如果配置了路由更好， 没有配置的话，也不影响。
>
假定环境如下： 
 `192.168.160.1` 为外网网卡路由
 `192.168.253.0/24` 为内网网段.
 
 | 主机名称 | 网卡1(ens33)           | 网卡2(ens32) |
 | ---- | --------------- | --------------- |
 | master1   | 192.168.160.243 | 192.168.253.129 |
 | master2   | 192.168.160.244 | 192.168.253.128 |
 | master3   | 192.168.160.245 | 192.168.253.130 |
 | node01    | 192.168.160.246 | 192.168.253.131 | 

ip和路由情况， 其他类同。

```
 $ ip a |grep inet 
    inet 127.0.0.1/8 scope host lo
    inet 192.168.253.129/24 brd 192.168.253.255 scope global noprefixroute dynamic ens32
    inet 192.168.160.243/23 brd 192.168.161.255 scope global noprefixroute ens33
$ ip route show | grep default
 default via 192.168.160.1 dev ens33
```

希望使用万兆`ens32`内网部署`kubernetes v1.19.2`高可用集群。

```
$ wget -c https://sealyun-home.oss-cn-beijing.aliyuncs.com/sealos/latest/sealos && \
    chmod +x sealos && mv sealos /usr/bin 

## 离线资源包自行下载， 默认已经下载到`/root/`。

$ sealos init --master 192.168.253.128 \
    --master 192.168.253.129 \
    --master 192.168.253.130 \
    --node 192.168.253.131 \
    --pkg-url /root/kube1.19.2.tar.gz \
    --version v1.19.2  \
    --passwd centos   \
    --interface ens32 | tee -a 1.19.2.new.log
```

> 参数名称解析

参数名|含义|示例
---|---|---
passwd|服务器密码|centos
master|k8s master节点IP地址| 192.168.253.128 
node|k8s node节点IP地址|192.168.253.131
pkg-url|离线资源包地址，支持下载到本地，或者一个远程地址|/root/kube1.19.2.tar.gz 
version|[资源包](https://www.sealyun.com/goodsList) 对应的版本|v1.19.2
interface|calico使用的网卡名称或者路由|ens32

**注意事项**： 

> 0. 各节点时间同步.
> 1. 各节点主机名不能重复.
> 2. 双网卡需要指定`interface`. 不然部署后， calico启动不了， 后面情形二会详细说明.
> 3. 服务器密码不一样，采用`--pk /root/.ssh/id_rsa` 密钥进行验证. 


## 情形二

> 有网络环境如下：每台服务器两张网卡，千兆网络直通互联网，默认路由走该网卡。

> 万兆网二层打通。 每台服务器有由于前期规划原因， 各网卡名称不一样， 万兆内网环境有路由。

假定环境如下： 
 `192.168.160.1` 为外网网卡路由
 `192.168.253.1` 为内网路由.
 
 | 主机名称 | 网卡1(外网网卡)          | 网卡2(内网网卡) |
 | ---- | --------------- | --------------- |
 | master1   | 192.168.160.243 | 192.168.253.129 |
 | master2   | 192.168.160.244 | 192.168.253.128 |
 | master3   | 192.168.160.245 | 192.168.253.130 |
 | node01    | 192.168.160.246 | 192.168.253.131 | 
 
希望使用万兆内网部署`kubernetes v1.19.2`高可用集群, 三层有路由`192.168.253.1`。

```
$ wget -c https://sealyun-home.oss-cn-beijing.aliyuncs.com/sealos/latest/sealos && \
    chmod +x sealos && mv sealos /usr/bin 

## 离线资源包自行下载， 默认已经下载到`/root/`。

$ sealos init --master 192.168.253.128 \
    --master 192.168.253.129 \
    --master 192.168.253.130 \
    --node 192.168.253.131 \
    --pkg-url /root/kube1.19.2.tar.gz \
    --version v1.19.2  \
    --passwd centos   \
    --interface 192.158.253.1 | tee -a 1.19.2.new.log
```

这里`--interface` 使用路由的原理是[IP_AUTODETECTION_METHOD](https://docs.projectcalico.org/reference/node/configuration#ip-autodetection-methods) 
`IP_AUTODETECTION_METHOD=can-reach=DESTINATION`。 目前这边使用的是`网卡名称`和`ipv4`， 来适配。 
如果自行安装cni。 使用`--without-cni` 来避免安装cni。 

node节点和master节点的api通信， 是sealos/lvscare， 基于内核ipvs， 类似kube-proxy的实现。 
node 节点如果默认路由是`192.168.160.1`. 则`10.103.97.2:6443 -> 192.168.253.129:6443` 这个就必然不通。
因此 sealos这里 为用户添加了一条专门的路由 `ip add r 10.103.97.2 via 192.168.253.131`. 通过万兆网卡来进行寻路。解决通信问题


情形三

网卡名称尽量统一， 如果做不到， 为万兆内网配一个网关吧.  用户自行解决

用户有情况需要用到防火墙`firewalld`.

---

### Archived 3.0 Plan Recovery Sealos (`docs/archived/3.0/plan/recovery_sealos.md`)

1. 如果有备份,则恢复备份.
2. 没有备份.手动恢复.

安装完成后, 默认会有以下目录. 手动恢复需要根据当前的节点情况自己写一些配置.

```
ls ~/.sealos
config.yaml
pki
sealos.log
```

配置 config.yaml

```
masters:
- 192.168.0.2
- 192.168.0.4
- 192.168.0.3
nodes:
- 192.168.0.5
- 192.168.0.6
dnsdomain: ""
apiservercertsans:
- apiserver.cluster.local
- 127.0.0.1
user: root
passwd: "123456"
privatekey: /root/.ssh/id_rsa
pkpassword: ""
apiserverdomain: apiserver.cluster.local
network: calico
vip: 10.103.97.2
pkgurl: /Users/louis/kube1.17.13.tar.gz
version: v1.17.13
repo: k8s.gcr.io
podcidr: 100.64.0.0/10
svccidr: 10.96.0.0/12
certpath: /root/.sealos/pki
certetcdpath: /root/.sealos/pki/etcd
lvscarename: fanux/lvscare
lvscaretag: latest
alioss:
  ossendpoint: ""
  accesskeyid: ""
  accesskeysecrets: ""
  bucketname: ""
  objectpath: ""

```

2. 恢复 pki 目录.


```
cd ~/.sealos
cp -r /etc/kubernetes/pki .
cp /etc/kubernetes/admin.conf .
cp /etc/kubernetes/controller-manager.conf .
cp /etc/kubernetes/scheduler.conf .
```

3. 重新 join 即可 宕机的 master 即可.

```
sealos join --master $masterip. 
```

---

### Archived 4.0 Docs Community (`docs/archived/4.0/docs/Community.md`)

# Community

Sealos is an open source project that is driven by the participation of users and contributors. If you have questions or suggestions about using the product while reading this documentation, please try the following ways to seek support. Our team and community will do their best to help you.

+ 💬 Join our [Discord server](https://discord.gg/qzBmGGZGk7) is to chat with Sealos developers and other Sealos users. This is a good place to learn about Sealos and Kubernetes, ask questions, and share your experiences.
+ 🐦 Tweet at @Sailos_io on [Twitter](https://twitter.com/Sailos_io) and follow us.
+ 🐞 Create [GitHub Issues](https://github.com/labring/sealos/issues/new/choose) for bug reports and feature requests.

---

### Archived 5.0 Docs Community (`docs/archived/5.0/docs/community.md`)

---
keywords: [Sealos, open source project, Kubernetes, Discord server, GitHub Issues]
description: Sealos is an open source project driven by user participation. Join our Discord server, tweet at @Sailos_io, or create GitHub Issues for support.
---

# Community

Sealos is an open source project that is driven by the participation of users and contributors. If you have questions or
suggestions about using the product while reading this documentation, please try the following ways to seek support. Our
team and community will do their best to help you.

+ 💬 Join our [Discord server](https://discord.gg/qzBmGGZGk7) is to chat with Sealos developers and other Sealos users.
  This is a good place to learn about Sealos and Kubernetes, ask questions, and share your experiences.
+ 🐦 Tweet at @Sailos_io on [Twitter](https://twitter.com/Sailos_io) and follow us.
+ 🐞 Create [GitHub Issues](https://github.com/labring/sealos/issues/new/choose) for bug reports and feature requests.

---

### Archived 4.0 Docs Advanced Guide How To Deploy The Application To Desktop (`docs/archived/4.0/docs/advanced-guide/how-to-deploy-the-application-to-desktop.md`)

# How to deploy the application to desktop

## Use Terminal to write app.yaml

### Key Information

- type: iframe, identified as a web application
- spec name is the name displayed on the desktop
- url application address
- icon is the icon displayed on the desktop

```yaml
apiVersion: app.sealos.io/v1
kind: App
metadata:
  name: app-sample
spec:
  name: Image Hub Demo
  icon:
  type: iframe
  data:
    url: https://hub.sealos.io/
    desc:
  icon: https://cloud.sealos.io/logo.svg
  menuData:
  displayType: normal
```



### apply yaml

```
kubectl apply -f app.yaml
```



### Refresh the browser, you can see the app on the desktop

---

### Archived 4.0 Docs Msa Privacy Policy (`docs/archived/4.0/docs/msa/privacy-policy.md`)

---
sidebar_position: 2
---

# Sealos Cloud Privacy Policy

We prioritize your privacy immensely. This policy details the collection, use, disclosure, and protection of your personal information when you utilize our services. Please thoroughly understand its contents.

**Information Collection**

1. We may gather your personal details like name, phone number, email, and address during registration or service usage.
2. We also collect data produced during service use, such as operational logs, IP addresses, and device types.
3. For enhanced user experience, technologies like cookies may be employed to store information related to your service interaction.

**Information Usage**

1. The handling of your personal data adheres to legal regulations and user agreements.
2. We utilize the information for improving service quality, innovating new products, and other similar purposes.
3. Collected data might be used for delivering service-related notifications and advertisements.

**Disclosure of Information**

1. Your personal data will not be shared with third parties, except under these circumstances:

   1. With your prior agreement;
   2. When legally or regulatorily required;
   3. To uphold our or other users' legal rights.

2. We may share your information with affiliated entities or partners, ensuring data security through strict confidentiality.

**Protection of Information**

1. We apply various security measures, like encryption and access control, to prevent unauthorized data access, use, or disclosure.
2. Regular safety assessments are conducted on stored personal data to guarantee its security.
3. Should a data leak or similar security incident occur, we'll immediately implement emergency measures and inform you as required by law.

**User Rights**

1. You have complete authority to access, correct, or delete your personal data at any time.
2. Opting out of data collection can limit your access to certain service features.
3. You may request a halt in processing your personal data, which might affect service continuation.

**Privacy Policy Updates**

1. We may periodically update this policy, and any changes will be published on our service page. Continuing service use implies acceptance of any updated terms.
2. Regularly reviewing this policy is encouraged to stay informed about your data protection.

**Minor Protection**

Minors' data protection is crucial to us. If you're a minor, please engage with our services under guardian supervision, ensuring proper data management.

**Cross-border Data Transfer**

Considering our servers' diverse locations, your data may be transferred and processed internationally. We assure that cross-border data remains securely protected.

**Contact Us**

1. For any questions, suggestions, or complaints about this policy, please reach us via email fanux@sealos.io
2. We are committed to quickly resolving any issues you raise.

---

### Archived 4.0 Docs Msa Terms Of Service (`docs/archived/4.0/docs/msa/terms-of-service.md`)

---
sidebar_position: 1
---

# Sealos Cloud Terms of Service

These Sealos Cloud Terms of Service (this “Agreement”) are entered into by and between you and Zhuhai Huanjie Cloud Computing Co., Ltd. (referred to as “we/us” or "the Company") regarding the use of our cloud services (hereafter referred to as "the Service"). We urge you to read and understand every clause, particularly those concerning limitations of our liability, restrictions on your rights, and the terms about dispute resolution and legal jurisdiction. If any aspect of this agreement is not acceptable to you, refrain from registering for or using the Service.

**Article 1: Scope of Services**

1. We offer a range of internet-based IT services, including but not limited to storage, computation, and network transmission.
2. Technical support and customer assistance will be provided to enhance your experience with the Service.
3. We reserve the right to modify, suspend, or discontinue any or all aspects of the Service without any obligation to you.

**Article 2: Account Registration and Management**

1. Prior to using the Service, registering an account is mandatory. You must ensure that the information provided at registration is accurate and updated regularly.
2. The security of your account credentials is your responsibility. Any misuse of your account should be reported to us immediately.
3. We hold the right to inspect your account and, if irregularities are detected, may halt or terminate the services provided to you.

**Article 3: Usage Guidelines**

1. The Service must not be used for illegal activities or in ways that infringe upon the rights of others, including intellectual property rights and confidentiality breaches.
2. The Service must not be used for malicious registration of accounts, whether for profit, speculation, or other purposes.
3. Dissemination of illegal, harmful, or malevolent content via the Service is strictly prohibited.
4. You are liable for adhering to all relevant laws and the terms of this agreement, including the responsibility for the content shared and outcomes arising from your use of the Service.

**Article 4: Fees and Payment**

1. You agree to the fee structure associated with the Service, as outlined in our published rates.
2. We may revise the fee structure based on market conditions, notifying you in advance. Continued use of the Service implies agreement to the revised fees.
3. Non-payment of fees may lead to the suspension or termination of the Service, and we retain the right to seek compensation.

**Article 5: Disclaimer and Limitation of Liability**

1. The Service is provided based on existing technology and conditions, and we do not guarantee uninterrupted, completely secure, or error-free service.
2. We are not liable for Service disruptions or unavailability due to force majeure.
3. We bear no responsibility for loss or damage of data caused by your actions.

**Article 6: Privacy Policy**

Your agreement to and compliance with our privacy policy, an integral part of this agreement, is required. Please refer to the detailed "Privacy Policy" section below.

**Article 7: Intellectual Property Rights**

1. The intellectual property of the Service and all related materials, including software and documentation, is owned by us. Unauthorized reproduction, distribution, or reverse engineering is prohibited.
2. While you retain intellectual property rights over your data and content generated within the Service, you grant us permission for necessary operations such as storage and backup to facilitate the Service.

**Article 8: Agreement Termination**

1. Violation of any terms of this agreement permits us to cease providing the Service immediately and to pursue legal remedies.
2. You can terminate this agreement by requesting the cancellation of your account.

**Article 9: Dispute Resolution and Governing Law**

1. This agreement is governed by the laws of the People's Republic of China. Disputes arising from this agreement should be resolved through negotiation; failing that, legal action may be pursued in a competent court.
2. The agreement includes provisions for resolving disputes and the applicable legal framework.

**Article 10: Network Security**

1. You bear the consequences for any services provided through the platform that violate national laws.
2. You are responsible for overseeing the services you offer and bear consequences for any illegal activities conducted by your users.
3. Should we discover your involvement in illegal activities, legal action will be taken and evidence provided to the authorities.

**Article 11: Additional Provisions**

1. Should parts of this agreement become invalid due to legal conflicts, it does not affect the validity of the remaining terms.
2. The Company retains the ultimate interpretive authority over this agreement and the privacy policy. For inquiries, please contact us.

---

### Archived 4.0 Docs Quick Start Next Steps (`docs/archived/4.0/docs/quick-start/next-steps.md`)

---
sidebar_position: 5
---

# Next Steps

Congratulations on getting started with Sealos! Now, you can continue learning more about Sealos's many features:

---

### Archived 4.0 Docs Quick Start Use App Launchpad (`docs/archived/4.0/docs/quick-start/use-app-launchpad.md`)

---
sidebar_position: 2
---

# Use App Launchpad

Sealos desktop is similar to that of PC operating systems, such as macOS or Windows. Each icon on the desktop represents an app, similar to the shortcuts in Windows. Like PC operating systems, Sealos also comes with built-in apps. To quickly install applications on this cloud operating system, you need to use the system's built-in **App Launchpad**.

> For more information about application management, please refer to [Introduction to App Launchpad](/guides/applaunchpad/applaunchpad.md)

This guide will show you how to quickly install some common applications on the Sealos cloud operating system.

## Deploy nginx

First, open App Launchpad in the [Sealos](https://cloud.sealos.io) desktop.



Click on "New Application".

Enter the application name and image name in sequence, enable external network access, and then click "Deploy Application" to proceed.



Once the deployment is finished, click "Details" to enter the application's detailed view.

you can view the operational metrics of the Nginx application, including CPU and memory usage. Click on the external link to open the Nginx interface directly via the external domain name.

---

### Archived 4.0 Docs Quick Start Use Database (`docs/archived/4.0/docs/quick-start/use-database.md`)

---
sidebar_position: 4
---

# Use Database

Databases are fundamental tools for data management, designed for efficient storage and access. Sealos offers a user-friendly database interface, eliminating the complexities of command-line operations. This assists in managing an array of databases, such as relational databases, NoSQL, vector databases, and streaming databases. With just a few clicks in the "[Database](/guides/dbprovider/dbprovider.md)" app, you can seamlessly create a variety of databases, including MySQL, PostgreSQL, MongoDB, Redis, and many more.

This guide will show you how to install MySQL use Databse app.

## Install MySQL

1. Open Database app in the [Sealos](https://cloud.sealos.io) desktop.



2. Click on 'Create Database' and finalize the basic configuration.



3. Click on 'Deploy' then click 'Confirm' to wait for the successful creation of the MySQL.



4. Click on 'connect', which will directly launch the "Terminal" application, leading you to the database command line.



## Install PostgreSQL and MongoDB

The installation process for PostgreSQL and MongoDB mirrors that of MySQL. Simply choose the respective database type on the basic configuration page.

---

### Archived 4.0 Docs Quick Start Use Template (`docs/archived/4.0/docs/quick-start/use-template.md`)

---
sidebar_position: 1
---

# Use Template

This guide will show you how to use templates to fast-track applications deployment. and maximize Sealos's features.

## 1. Find a template

Start by accessing the "**Templates**" in the Sealos desktop.



select the template you’d like to deploy



Not sure which one to use? How about [exploring FastGPT](/examples/ai-applications/install-fastgpt-on-desktop.md)

## 2. Deploy the template to Sealos

Once you've selected a template, configure the necessary parameters, then click **Deploy Application** on the template page to start deployment.



Once deployment concludes, click "Confirm" to navigate to the application's details.



Wait for the application's status to switch to running. Subsequently, click on the external link to launch the application's Web interface directly through the external domain name.

---

### Archived 4.0 I18n Zh Hans Community (`docs/archived/4.0/i18n/zh-Hans/Community.md`)

# 社区

Sealos 是一个由用户和贡献者参与推动的开源项目，如果您对产品使用存在疑问和建议，可尝试以下方式寻求支持。我们的团队与社区会竭尽所能为您提供帮助。

+ 📱 扫码加入社区微信交流群👇
  
  

+ 💬 加入我们的 [Discord 服务器](https://discord.gg/qzBmGGZGk7)，与 Sealos 开发者和终端用户进行交流。
+ 🐦 在 [Twitter](https://twitter.com/Sailos_io) 上关注我们。
+ 🐞 请将任何 Sealos 的 Bug、问题和需求提交到 [GitHub Issue](https://github.com/labring/sealos/issues/new/choose)。

---

### Archived 5.0 Docs Msa Privacy Policy (`docs/archived/5.0/docs/msa/privacy-policy.md`)

---
sidebar_position: 2
---

# Sealos Cloud Privacy Policy

We prioritize your privacy immensely. This policy details the collection, use, disclosure, and protection of your
personal information when you utilize our services. Please thoroughly understand its contents.

**Information Collection**

1. We may gather your personal details like name, phone number, email, and address during registration or service usage.
2. We also collect data produced during service use, such as operational logs, IP addresses, and device types.
3. For enhanced user experience, technologies like cookies may be employed to store information related to your service
   interaction.

**Information Usage**

1. The handling of your personal data adheres to legal regulations and user agreements.
2. We utilize the information for improving service quality, innovating new products, and other similar purposes.
3. Collected data might be used for delivering service-related notifications and advertisements.

**Disclosure of Information**

1. Your personal data will not be shared with third parties, except under these circumstances:

    1. With your prior agreement;
    2. When legally or regulatorily required;
    3. To uphold our or other users' legal rights.

2. We may share your information with affiliated entities or partners, ensuring data security through strict
   confidentiality.

**Protection of Information**

1. We apply various security measures, like encryption and access control, to prevent unauthorized data access, use, or
   disclosure.
2. Regular safety assessments are conducted on stored personal data to guarantee its security.
3. Should a data leak or similar security incident occur, we'll immediately implement emergency measures and inform you
   as required by law.

**User Rights**

1. You have complete authority to access, correct, or delete your personal data at any time.
2. Opting out of data collection can limit your access to certain service features.
3. You may request a halt in processing your personal data, which might affect service continuation.

**Privacy Policy Updates**

1. We may periodically update this policy, and any changes will be published on our service page. Continuing service use
   implies acceptance of any updated terms.
2. Regularly reviewing this policy is encouraged to stay informed about your data protection.

**Minor Protection**

Minors' data protection is crucial to us. If you're a minor, please engage with our services under guardian supervision,
ensuring proper data management.

**Cross-border Data Transfer**

Considering our servers' diverse locations, your data may be transferred and processed internationally. We assure that
cross-border data remains securely protected.

**Contact Us**

1. For any questions, suggestions, or complaints about this policy, please reach us via email fanux@sealos.io
2. We are committed to quickly resolving any issues you raise.

---

### Archived 5.0 Docs Msa Terms Of Service (`docs/archived/5.0/docs/msa/terms-of-service.md`)

---
sidebar_position: 1
---

# Sealos Cloud Terms of Service

These Sealos Cloud Terms of Service (this “Agreement”) are entered into by and between you and Zhuhai Huanjie Cloud
Computing Co., Ltd. (referred to as “we/us” or "the Company") regarding the use of our cloud services (hereafter
referred to as "the Service"). We urge you to read and understand every clause, particularly those concerning
limitations of our liability, restrictions on your rights, and the terms about dispute resolution and legal
jurisdiction. If any aspect of this agreement is not acceptable to you, refrain from registering for or using the
Service.

**Article 1: Scope of Services**

1. We offer a range of internet-based IT services, including but not limited to storage, computation, and network
   transmission.
2. Technical support and customer assistance will be provided to enhance your experience with the Service.
3. We reserve the right to modify, suspend, or discontinue any or all aspects of the Service without any obligation to
   you.

**Article 2: Account Registration and Management**

1. Prior to using the Service, registering an account is mandatory. You must ensure that the information provided at
   registration is accurate and updated regularly.
2. The security of your account credentials is your responsibility. Any misuse of your account should be reported to us
   immediately.
3. We hold the right to inspect your account and, if irregularities are detected, may halt or terminate the services
   provided to you.

**Article 3: Usage Guidelines**

1. The Service must not be used for illegal activities or in ways that infringe upon the rights of others, including
   intellectual property rights and confidentiality breaches.
2. The Service must not be used for malicious registration of accounts, whether for profit, speculation, or other
   purposes.
3. Dissemination of illegal, harmful, or malevolent content via the Service is strictly prohibited.
4. You are liable for adhering to all relevant laws and the terms of this agreement, including the responsibility for
   the content shared and outcomes arising from your use of the Service.

**Article 4: Fees and Payment**

1. You agree to the fee structure associated with the Service, as outlined in our published rates.
2. We may revise the fee structure based on market conditions, notifying you in advance. Continued use of the Service
   implies agreement to the revised fees.
3. Non-payment of fees may lead to the suspension or termination of the Service, and we retain the right to seek
   compensation.

**Article 5: Disclaimer and Limitation of Liability**

1. The Service is provided based on existing technology and conditions, and we do not guarantee uninterrupted,
   completely secure, or error-free service.
2. We are not liable for Service disruptions or unavailability due to force majeure.
3. We bear no responsibility for loss or damage of data caused by your actions.

**Article 6: Privacy Policy**

Your agreement to and compliance with our privacy policy, an integral part of this agreement, is required. Please refer
to the detailed "Privacy Policy" section below.

**Article 7: Intellectual Property Rights**

1. The intellectual property of the Service and all related materials, including software and documentation, is owned by
   us. Unauthorized reproduction, distribution, or reverse engineering is prohibited.
2. While you retain intellectual property rights over your data and content generated within the Service, you grant us
   permission for necessary operations such as storage and backup to facilitate the Service.

**Article 8: Agreement Termination**

1. Violation of any terms of this agreement permits us to cease providing the Service immediately and to pursue legal
   remedies.
2. You can terminate this agreement by requesting the cancellation of your account.

**Article 9: Dispute Resolution and Governing Law**

1. This agreement is governed by the laws of the People's Republic of China. Disputes arising from this agreement should
   be resolved through negotiation; failing that, legal action may be pursued in a competent court.
2. The agreement includes provisions for resolving disputes and the applicable legal framework.

**Article 10: Network Security**

1. You bear the consequences for any services provided through the platform that violate national laws.
2. You are responsible for overseeing the services you offer and bear consequences for any illegal activities conducted
   by your users.
3. Should we discover your involvement in illegal activities, legal action will be taken and evidence provided to the
   authorities.

**Article 11: Additional Provisions**

1. Should parts of this agreement become invalid due to legal conflicts, it does not affect the validity of the
   remaining terms.
2. The Company retains the ultimate interpretive authority over this agreement and the privacy policy. For inquiries,
   please contact us.

---

### Archived 5.0 Docs Quick Start Quick Start (`docs/archived/5.0/docs/quick-start/quick-start.md`)

---
keywords: [Flarum deployment, Sealos App Store, open source forum, deploy Flarum, Sealos desktop]
description: Quickly deploy Flarum using Sealos. Follow our step-by-step guide to get your open source forum up and running in no time.
---

# Quick Start

Deploy Flarum quickly with Sealos.

> Flarum is a very simple open source forum software. It's responsive, easy to use, and has all the features you need to
> build a successful community. It's also extremely extensible, allowing for ultimate customizability.

Open the Sealos desktop and click App Store.



Click on the Flarum app (the search bar in the upper left corner can quickly find the app).



Click Deploy App.



Wait for the status of all components to change to running, which means that the components have been started (you can
re-enter the current page refresh state).



Return to the Sealos desktop and click on the Flarum app.



Successfully accessed Flarum.

---

### Archived 5.0 I18n Zh Hans Community (`docs/archived/5.0/i18n/zh-Hans/community.md`)

---
keywords: [Sealos社区, 开源项目, 微信交流群, Discord服务器, GitHub Issue, 技术支持, 用户交流, 问题反馈]
description: 探索Sealos开源社区：加入微信群、Discord服务器与开发者交流，关注Twitter获取最新动态，通过GitHub反馈问题。我们致力于为您提供全方位支持。
---

# 社区

Sealos 是一个由用户和贡献者参与推动的开源项目，如果您对产品使用存在疑问和建议，可尝试以下方式寻求支持。我们的团队与社区会竭尽所能为您提供帮助。

+ 📱 扫码加入社区微信交流群👇



+ 💬 加入我们的 [Discord 服务器](https://discord.gg/qzBmGGZGk7)，与 Sealos 开发者和终端用户进行交流。
+ 🐦 在 [Twitter](https://twitter.com/Sailos_io) 上关注我们。
+ 🐞 请将任何 Sealos 的 Bug、问题和需求提交到 [GitHub Issue](https://github.com/labring/sealos/issues/new/choose)。

---

### Archived 4.0 Docs Advanced Guide Architecture Architecture (`docs/archived/4.0/docs/advanced-guide/Architecture/Architecture.md`)

# Architecture Description

Sealos is built using the approach of application separation and application interconnection, where different applications can be deployed independently or combined with other applications to provide services.

All services are authenticated using `kubeconfig` as the application identity, ensuring a consistent user experience whether in a browser, using the `sealos` command line locally, or even with a third-party client.

## Overall Architecture



## Application Architecture

Applications on Sealos adopt a front-end and back-end separation architecture, and the front-end can provide `SSR` capabilities, allowing applications to provide services independently to the outside world without being bound to the Sealos monolith.

Using the following diagram as an example: 

**App Launchpad** is a application deployment tool provided by Sealos, and **Terminal** is a terminal application for the Sealos system, providing command-line services consistent like a single-machine operating system terminal.
For various applications on Sealos, they can interact directly with `Kubernetes` services, or interact with various CRD controllers such as Terminal Controller and Ingress-Nginx Controller, etc.
Applications can also call each other, for example, a database created by a user in the **Database** application can directly invoke the **Terminal** application and automatically connect to the database for debugging.

For more information, please refer to the [link](../../guides) documentation.

---

### Archived 4.0 Docs Examples Ai Applications Install Fastgpt On Desktop (`docs/archived/4.0/docs/examples/ai-applications/install-fastgpt-on-desktop.md`)

---
sidebar_position: 1
---

# Quick Installation of FastGpt AI Knowledge Base

No server, no magic, no domain name, click to deploy 👇

[](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Dfastgpt)

The database needs to be deployed. After the deployment, you need to wait 2 to 4 minutes to access the database. The minimum configuration is used by default, and the first access is a little slow.



## Run

Click on the [external address] provided by sealos to use it. The login user name is root, and the password is the newly set environment variable (1234 in the figure above)

---

### Archived 4.0 Docs Examples Baas Install Fireboom (`docs/archived/4.0/docs/examples/baas/install-fireboom.md`)

# Quick Installation of Fireboom

[Fireboom](https://fireboom.io) is a visual API development platform designed for developers, providing a declarative development framework, a visual editing suite, and a hook mechanism.


Official website: https://fireboom.io

**Features**

- Minute-level delivery: Reduce the interface development time from 2 days to 2 minutes in traditional mode.

- Front-end to full-stack: Visual development significantly reduces the threshold for interface development, allowing front-end developers to easily become full-stack developers.

- Back-end without bricklaying: Declarative programming avoids copy and paste, reduces the probability of bugs, and allows back-end developers to focus on business development.

## Step 1: Create a New Application

- Open the "Application Management" application in the [Sealos](https://cloud.sealos.io) desktop environment.



- In "Application Management", click "Create New Application" to create a new application.


## Step 2: Application Deployment

- Basic Configuration:
  
  - Application Name (custom): fireboom
  
  - Image Name (default latest version): fireboomapi/fireboom_server:latest
  
  - CPU (recommended): 2 Core (minimum 1 Core)
  
  - Memory (recommended): 4 G (minimum 512 M)

- Deployment Mode:
  
  - Number of Instances (custom): 1



- Network Configuration:
  
  - Control Panel: 9123
  - API Endpoint: 9991, enable external access



- Advanced Configuration:

  - Command Settings:
    - Parameter Settings: dev (dev for development mode, start for production mode)
  
  - Persistent Storage:

    - Metadata: /fbserver/store
    - Uploaded Files: /fbserver/upload




## Step 3: Deploy the Application

1. Click "Deploy Application" to start deploying the application.



2. Click "Details" to check. When the STATUS of the application changes from Pending to Running, it means that the application has been successfully launched.



## Step 4: Access the Application

- Access the Control Panel: Domain corresponding to 9123



- Access the API Endpoint: Domain corresponding to 9991

```
status ok
```

## Step 5: Configure Fireboom (optional)

After setting, you can easily use the Swagger document~

1. View the public address of the API: Settings -> System



2. Modify it to the public domain of the API endpoint, corresponding to 9991

    - Static Value: Select static value and set it to the public domain of the **API Endpoint**
    - Environment Variable: Go to Environment Variables, find FB_API_PUBLIC_URL and set it to the public domain of the **API Endpoint**




3. Use the Swagger document to test the API

---

### Archived 4.0 Docs Examples Blog Platform Install Halo (`docs/archived/4.0/docs/examples/blog-platform/install-halo.md`)

---
sidebar_position: 2
---

# Quick Installation of Halo Blogging Platform

Deploy Halo Blogging Platform swiftly on Sealos



[Halo](https://github.com/halo-dev/halo) is a powerful and easy-to-use open-source website building tool. 
This article will introduce how to deploy Halo on Sealos, while deploying PostgreSQL on Sealos can help you easily manage and maintain the database to meet different business needs.

## Step 1: Deploy PostgreSQL on Sealos

### First, open [Sealos](https://cloud.sealos.io) and click on "More Apps" to enter the PostgreSQL deployment interface:



### Fill in the configuration

In the PostgreSQL deployment interface, click on "Create Cluster" and fill in the relevant configuration information as prompted.



After entering the corresponding configuration, click on "Create Cluster":



### Check the database configuration:



Save the generated configuration containing the database username, password, and connection method for use in the following Halo configuration:



> The PostgreSQL configuration can be seen in the image as follows:
>
> Username: root
>
> Password: jxidRwmY82eeuFa01tHN28msb86woounM0QMbyl1jhwzKxT9IDqlNkFfyy4R34G3 
>
> pg DNS name: acid-halo-pg.ns-sy32q9p9.svc.cluster.local:5432

## Step 2: Deploy Halo on Sealos

### Open App Launchpad





### Fill in the configuration

- Customize the application name

- Set the image name to `halohub/halo:2.5`

- CPU and storage should be configured according to actual conditions, memory requires 500Mi to start Halo, you can refer to the official [prepare](https://docs.halo.run/getting-started/prepare) 

- Expose port should be 8090. At the same time, setting it to external network access will automatically configure an exit domain for the application for external network access, and you also need to configure this address in Halo

- Environment variables include database configuration and other related configurations. It is important to note that you need to configure the database connection information based on the username, password, and DNS you set in Step 1. Additionally, you need to configure the username and password for the super administrator of Halo.

Configure Halo environment variables as follows:

```Bash
spring.sql.init.platform=postgresql
spring.r2dbc.url=r2dbc:pool:postgresql://acid-halo-pg.ns-sy32q9p9.svc.cluster.local:5432/halo
spring.r2dbc.username=root
spring.r2dbc.password=jxidRwmY82eeuFa01tHN28msb86woounM0QMbyl1jhwzKxT9IDqlNkFfyy4R34G3
halo.external-url=tmtdvfjiyyfh.cloud.sealos.io
halo.security.initializer.superadminusername=root
halo.security.initializer.superadminpassword=sealos
```

Detailed explanation of environment variable configuration:

| Parameter Name                                 | Description                                                                                              |
|------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| spring.r2dbc.url                               | Database connection address, see Database Link Format below for details                                  |
| spring.r2dbc.username                          | Database username                                                                                        |
| spring.r2dbc.password                          | Database password                                                                                        |
| spring.sql.init.platform                       | Database platform name, supports postgresql, mysql, h2                                                   |
| halo.external-url                              | External access link, if you need public network access, you need to configure the actual access address |
| halo.security.initializer.superadminusername   | Initial super administrator username                                                                     |
| halo.security.initializer.superadminpassword   | Initial super administrator password                                                                     |

Database link format (here we use the postgresql format):

| Connection Method | Connection Address Format                                                          | spring.sql.init.platform |
|-------------------|------------------------------------------------------------------------------------|--------------------------|
| PostgreSQL        | r2dbc:pool:postgresql://`{HOST}`:`{PORT}`/`{DATABASE}`                             | postgresql               |
| MySQL             | r2dbc:pool:mysql://`{HOST}`:`{PORT}`/`{DATABASE}`                                  | mysql                    |
| MariaDB           | r2dbc:pool:mariadb://`{HOST}`:`{PORT}`/`{DATABASE}`                                | mysql                    |
| H2 Database       | r2dbc:h2:file:///`${halo.work-dir}`/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE | h2                       |

### Network configuration



### Environment variable configuration



### Configure Persistent Storage Volume

Mount `/root/.halo2` directory to persist Halo data:



## Step 3: Access Halo via the Public Network

After successfully launching the application, you can access Halo through the public network address for configuration:





### **Initialize Halo**





### **First Halo:**







## FAQ

### Forgot Password

#### Enter the App Launchpad and click on "Logs":





You can see the following information in the logs: Username: `admin` Password: `QTu2J2xgUQ3ngqUo`

#### Alternatively, you can view the logs by executing the following command in the terminal:



```
root@td3q8uc46:~# kubectl logs halo-0 | grep 'Generated random password:' | tail -1
2023-05-30T13:32:16.942+08:00  INFO 7 --- [-controller-t-1] r.h.app.security.SuperAdminInitializer   : === Generated random password: QTu2J2xgUQ3ngqUo for super administrator: admin ===
```

---

### Archived 4.0 Docs Examples Blog Platform Install Wordpress (`docs/archived/4.0/docs/examples/blog-platform/install-wordpress.md`)

---
sidebar_position: 1
---

# Quick Installation of WordPress

[WordPress](https://github.com/WordPress/WordPress) is a powerful, user-friendly and open source content management system (CMS) that can be used to publish websites, news, blogs and other content online. It provides convenient methods for content editing, publishing and updating, and can also be highly customized through themes and plugins. WordPress has become a very successful and popular CMS system, with over 30 million websites built on WordPress worldwide.

> By deploying **WordPress** with **Sealos**, you can greatly reduce deployment time and start users' content publishing journey at lightning speed.

WordPress requires a MySQL database to be installed and used together. As a best practice for using Sealos, it is recommended to deploy the MySQL database independently using a database application, and quickly install WordPress based on the independent database.


## Create MySQL instance

Open the **Database** application in the [Sealos](https://cloud.sealos.io) desktop environment, quickly set up the required database instance and wait for the database deployment to be completed.







## Create a New Database

When installing a MySQL instance through the **Database** application, user-defined databases are not automatically created. When connecting an application to the MySQL database, you need to manually create the corresponding database in the MySQL instance.

You can access the database terminal command line in the following ways:




Alternatively, you can access the database terminal command line using the following methods:

`mysql -u username -p -h yourhost`



After successfully connecting to the database, you can create a new database using the following command:

`CREATE DATABASE yourdb;`

At this point, you have manually created a user-defined database in the MySQL instance.

## App Launchpad

Click on App Launchpad to enter the installation interface.



## Basic Configuration

Begin by setting a custom application name and selecting the image to install. Sealos supports both public and private image sources. In this example, the official image source is used, and if no image version is specified, the latest version will be pulled by default.

Next, configure CPU and memory resources for WordPress. WordPress is very lightweight, and a small amount of resources is sufficient to ensure the normal operation of the program.



## NetWork Configuration

For network configuration, enable external access, and Sealos will automatically assign an exit domain name for users to access from the internet. If the user has already registered their custom domain, they can create a CNAME record pointing to the assigned exit domain name, allowing the custom domain to be used to access the installed application.

Note: In subsequent demonstrations, a randomly generated exit domain name by Sealos will be used.




## Advanced Configuration

In the advanced configuration, you need to configure the environment variables for WordPress based on the actual database situation.

In the advanced configuration, you need to set environment variables and local storage for WordPress.

Common WordPress environment variables are shown below:

```Plain
WORDPRESS_DB_HOST       IP address of the database instance
WORDPRESS_DB_USER       Database user for connection
WORDPRESS_DB_PASSWORD   User password required for connecting to the database
WORDPRESS_DB_NAME       Name of the connected database
```

Based on the previously installed MySQL example, you can configure the environment variables as follows:

```Plain
WORDPRESS_DB_HOST     Database IP Address
WORDPRESS_DB_USER     Database username
WORDPRESS_DB_PASSWORD Database password
```

The storage volume mount point for the official WordPress image is: /var/www/html. Users can allocate storage space for the application according to their needs.

With this, WordPress is also successfully installed. Click on the details, and you can successfully access it through the external network address.



Click on the link, and the following page shows that the installation was successful:



**Note: If the deployment fails, first check whether the user-defined database that WordPress is trying to access exists in the MySQL instance.**

---

### Archived 4.0 Docs Examples Dial Testing System Install Uptime Kuma (`docs/archived/4.0/docs/examples/dial-testing-system/install-uptime-kuma.md`)

---
sidebar_position: 1
---

# Quick Installation of Uptime Kuma





[Uptime Kuma](https://github.com/louislam/uptime-kuma) is an open-source and easy-to-use server monitoring tool. It helps you monitor the real-time status, response time, and other key metrics of your server to ensure that it always remains in optimal condition. If you want to quickly install Uptime Kuma, follow these steps:

### Step 1: First, enter Sealos and open the App Launchpad



### Step 2: Create a New Application

Open the App Launchpad in the [Sealos](https://cloud.sealos.io) desktop environment, click "New Application" to create a new application.



### Step 3: Set Startup Parameters

Configure the startup parameters as follows:

- Set the container exposed port to 3001
- Enable public network access to access the application via the provided domain





### Step 4: Set up Storage Volumes

In the advanced settings, add a storage volume mount to persist the Uptime Kuma data directory `/app/data`. This ensures that the application data is not lost when the container restarts.



### Step 5: Deploy the Application

Click 「Deploy Application」 to start the application:



### Step 6: Access the Application

Once the application is successfully launched, you can access it using its public network address. Enter the application domain in your browser to access the main interface.



### Step 7: Create an Administrator Account

To ensure the security of Uptime Kuma, you will need to create an administrator account when you first access the application. Fill in the basic information for the administrator account, including the username and password. After completing the form, click the "Create" button to register the account.



### Step 8: Add Custom Monitoring Items

---

### Archived 4.0 Docs Examples Gitea Install Gitea (`docs/archived/4.0/docs/examples/gitea/install-gitea.md`)

# Quick Installation of Gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, includes Git hosting, code review, team collaboration, package registry and CI/CD.

## Step 1: Log in to Sealos

- Go to the [Sealos](https://cloud.sealos.io/) official website



## Step 2: Open the App Launchpad 



## Step 3: Create a new application

- In App Launchpad, click "Create New Application" to create a new application.



## Step 4: Application deployment

- Basic configuration:

  - Application name (custom): gitea
  - Image name (default latest version): gitea/gitea:latest-rootless
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G

- Deployment mode:

  - Number of instances (custom): 1



- Network configuration:

  - Container  port: 3000
  - Accessible to the Public: enabled



- Advanced configuration:

  - Custom local storage, persist Gitea data (recommended 1 G).
  



## Step 5: Deploy the application

- Click「Deploy Application」 to start deploying the application.



## Step 6: Configure the database

- Configure MySQL database for Gitea via Sealos
- Click Database



- Create a new database



- Basic configuration:

  - Cluster type: mysql
  - Database version: ac-mysql-8.0.30
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
  



- After deployment is successful, enter the details page to view the MySQL connection information



- Click "One-click Connection" to enter the MySQL terminal connection



- Execute

```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
```

Create the database needed for Gitea



## Step 7: Access the application

- Click 「App Launchpad」 to view.When the application's STATUS changes from Pending to Running, it means the application has started successfully.

- When the STATUS is Running, you can directly access the external address.



- After accessing the external address, enter the configuration page and configure according to the details of the MySQL just created



- After configuring, click Install, wait for a while and you can enter the login page, deployment successful!

---

### Archived 4.0 Docs Examples Low Code Platform Install Appsmith (`docs/archived/4.0/docs/examples/low-code-platform/install-appsmith.md`)

# Quick installation of Appsmith

[Appsmith](https://github.com/appsmithorg/appsmith) is an open-source platform to build, deploy, and maintain internal apps. You can build anything from simple CRUD apps, admin panels, dashboards to custom business apps and complicated multi-step workflows.

## Step 1: Step 1: open the App Launchpad application in the [Sealos](https://cloud.sealos.io) desktop environment



## Step 2: create a new application

- In App Launchpad, click "New Application" to create a new application.



## Step 3: application deployment

- Basic configuration:
  
  - Application name (Custom): appsmith
  
  - Image name (default latest version): appsmith/appsmith-ce
  
  - CPU (recommended): 2 Core
  
  - Memory (recommended): 4 GB

- deployment mode:
  
  - number of instances (custom): 1



- Network configuration:
  
  - Container exposure port: 80
  
  - Public network access: enabled



- Advanced configuration:
  
  - Customize local storage and persist Appsmith data (15 GB is recommended).



## Step 4: deploy the application

- Click "deploy Application" to start deploying the application.



## Step 5: access the application

- Click "details" to view, when the STATUS of the application has changed from Pending to Running, it indicates that the application has been launched successfully.

- When STATUS is Running, you can directly access the public network address.



- The visit was successful!

---

### Archived 4.0 Docs Examples Low Code Platform Install Pageplug (`docs/archived/4.0/docs/examples/low-code-platform/install-pageplug.md`)

# Quick installation of PagePlug

[PagePlug](https://github.com/cloudtogo/pageplug) is a Chinese project of [Appsmith](https://github.com/appsmithorg/appsmith), which optimizes the overall performance and Sinicizes based on Appsmith, and also integrates the characteristic form solution Formily component, chart solution Echarts component, low code Mini Program development, etc.
Is an open source, declarative, visual, intuitive front-end low-code framework for research and development.

## Step 1: Step 1: open the App Launchpad application in the [Sealos](https://cloud.sealos.io) desktop environment



## Step 2: create a new application

- In App Launchpad, click "New Application" to create a new application.



## Step 3: application deployment

- Basic configuration:
  
  - Application name (Custom): pageplug
  
  - Image name (default latest version): cloudtogouser/pageplug-ce
  
  - CPU (recommended): 2 Core
  
  - Memory (recommended): 4 GB

- Deployment model:
  
  - Number of instances (custom): 1



- Network configuration:
  
  - Container exposure port: 80
  
  - Public network access: enabled



- Advanced configuration:
  
  - Customize local storage and persist PagePlug data.



## Step 4: deploy the application

- Click "deploy Application" to start deploying the application.



## Step 5: access the application

- Click "details" to view, when the STATUS of the application has changed from Pending to Running, it indicates that the application has been launched successfully.





- When STATUS is Running, you can directly access the public network address.



- If a 503 exception occurs in the access, wait for a while and try again.



- The visit was successful!

---

### Archived 4.0 Docs Examples Others Install Anki (`docs/archived/4.0/docs/examples/others/install-anki.md`)

# Quick Installation of a Custom Anki Sync Server

Anki is a spaced repetition flashcard program. Essentially, it is a card sorting tool that **actively tests users on custom card content, allows users to self-grade their responses, and then uses an algorithm to reschedule cards based on the judgments to optimize long-term retention**.

The so-called "cards" are technically called flash cards. They are small cards with a question or prompt on one side and the answer on the reverse side. You first read the question/prompt, try to recall the answer mentally, then flip the card to verify against the answer provided.

The core principle of flashcard creation is:**one knowledge point per card**. As such, Anki is well-suited for learning languages, memorizing historical dates, formulas, etc.

Anki's official sync server is hosted overseas and is a personal project with limited bandwidth. Syncing is very slow. To sync learning progress and new cards across multiple clients would be extremely painful.

To address this, we need to deploy a custom sync server and have the clients connect to it instead.

## Deploying an Anki Sync Server

Since the February 2023 release of Anki 2.1.57 for desktop, Anki on desktop, Android, and iOS now support custom sync servers without needing to install plugins. Anki users no longer need to worry about sync issues. The longstanding sync problem has finally been completely solved.

Currently, the only project that supports the latest Anki versions is [anki-sync-server-rs](https://github.com/ankicommunity/anki-sync-server-rs). Other sync server projects are now mostly obsolete. This Rust project tracks progress on Anki's official sync server and also uses sqlite as the backend data store.

Below we will deploy anki-sync-server-rs on Sealos and configure it.

First, enter the URL https://cloud.sealos.io/ in your browser to access the Sealos desktop. Then open "App Launchpad":



Click "Create Application":



Enter the application name and image name. The exposed container port is `27701`. Enable external network access:



Scroll down and expand "Advanced Configuration". Click "Edit Environment Variables":



Paste the following into the environment variable input box:

```
bash
Copy code

ANKISYNCD_USERNAME=<USERNAME>  
ANKISYNCD_PASSWORD=<PASSWD>
```

Replace `<USERNAME>` with your username and `<PASSWD>` with your password.



Click "Add Storage Volume":



Set the mount path to `/app` and confirm:



Finally, click "Deploy Application" in the top right corner.

After deployment, click "Details" to enter the application details screen.



Here you can see the instance status. Wait until the status shows as "running" before proceeding. If it stays pending for a while, click "Details" to check the failure reason:



Once deployed successfully, you can monitor metrics like CPU and memory usage. Click the external URL to directly access the sync server's web interface.



If you see the following screen, the deployment succeeded:



Viewing logs is also straightforward - click the "three dots" on the instance panel and select "Logs":





## Client Configuration

### Desktop

To configure the desktop client (macOS/Windows/Linux):

1. Open "Preferences"

   

2. Click "Network" and look for the "self-hosted sync server" section. Enter your server's address:

   

3. Restart Anki and click "Sync":

   

4. A prompt will appear asking for username and password. Enter what you configured earlier:

   

5. Click OK and syncing will begin.

### Android

On Android, directly configure via "Settings -> Advanced -> Custom sync server":



Also enter username and password:

> Settings -> Basic -> AnkiWeb Account

This completes the configuration. All card decks should sync over:




The official app version is quite old. For the latest community version, download the Beta here:

- https://github.com/ankidroid/Anki-Android/releases

The **arm64-v8a** version is recommended.

After installing, the sync server can be configured under "Settings -> Sync -> Custom sync server":



Also enter the username and password:

> Settings -> Sync -> AnkiWeb Account

### iOS

AnkiMobile also supports syncing with a custom server. At least version Ankimobile 2.0.90(20090.2) seems to work based on [reports in the Anki forums](https://forums.ankiweb.net/t/ankimobile-self-sync-server-failure-the-one-bundled-in-version-2-1-60-qt6/27862).

If you encounter sync issues after configuring, try toggling "Allow Anki to access local network" off and on in iOS settings per Anki's docs:

> If you're using AnkiMobile and are unable to connect to a server on your local network, please go into the iOS settings, locate Anki near the bottom, and toggle "Allow Anki to access local network" off and on again.

The tip above is excerpted from the [Anki tutorial](https://docs.ankiweb.net/sync-server.html#client-setup).

---

### Archived 4.0 Docs Examples Programming Languages Quick Installation Of Go Apps (`docs/archived/4.0/docs/examples/programming-languages/Quick installation of Go Apps.md`)

# Quick installation of Go Apps

First, make sure you have installed the following tools:

- Docker

## Step 1: Write Your Go Program

```go
package main

import (
	"fmt"
	"net/http"
)

func main() {
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Hello, World!")
	})

	http.ListenAndServe(":8080", nil)
}
```

## Step 2: Create Docker Image

- In the same directory as `main.go`, create a file named `Dockerfile` with the following content:

```
FROM golang:1.17 as builder

WORKDIR /app
COPY . .

RUN go mod init myapp
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/main /app/

EXPOSE 8080
ENTRYPOINT ["/app/main"]
```

This `Dockerfile` defines a multi-stage build process. In the first stage, we use the official `golang` image as the base image and then compile the Go application. In the second stage, we use the lightweight `alpine` image, copy the compiled binary file to the `/app` directory, and expose port 8080.

- Run the following command in the directory where the `Dockerfile` is located to build a Docker image for the Go application:

```
docker build -t your_image_name .
```

Replace `your_image_name` with your image name and tag.

## Step 3: Push Docker Image

- Push the created Docker image to a Docker repository, such as Docker Hub or a private repository. **Assuming you are already logged in to the Docker repository**, use the following command to push the image:

  - First, tag the Docker image. Before pushing an image, you need to add a tag to it so that Docker knows where to push it. Run the following command to add a tag to the image:

    ```
  docker tag your-image-name your-dockerhub-username/your-repo-name:your-tag
    ```
    
    Replace `your-image-name` with your local image name, `your-dockerhub-username` with your Docker Hub username, `your-repo-name` with the repository name you want to create on Docker Hub, and `your-tag` with the tag you set for the image (e.g., latest).

    For example:

    ```
  docker tag demo damager6666/demo:latest
    ```

  - Next, push the Docker image. Use the following command to push the image to Docker Hub:
  
    ```
    docker push your-dockerhub-username/your-repo-name:your-tag
    ```
    
    Replace `your-dockerhub-username`, `your-repo-name`, and `your-tag` with the actual values. For example:

    ```
    docker push damager6666/demo:latest
    ```

## Step 4: Log in to Sealos

- Go to the [Sealos](https://cloud.sealos.io/) official website



## Step 5: Open the "App Launchpad" App



## Step 6: Create a New Application

- In "App Launchpad", click "Create New Application" to create a new application.



## Step 7: Application Deployment

- Basic Configuration:
  - Application Name (custom): go-demo
  - Image Name: damager6666/demo:latest
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
- Deployment Mode:
  - Number of Instances (custom): 1



- Network Configuration:
  - Container Exposed Port: 8080
  - Internet Access: Enable



## Step 8: Deploy Application

- Click "Deploy Application" to start deploying the application.



## Step 9: Access Application

- Click "Application Management" to view. When the application's STATUS changes from Pending to Running, it means the application has started successfully.
- When STATUS is Running, you can directly access the external network address.



- In the browser, enter

```
https://tmgkflgdlstl.cloud.sealos.io/hello
```



- The page displays "Hello, World!", indicating that your Go application is running on Sealos.

---

### Archived 4.0 Docs Examples Programming Languages Quick Installation Of Java Apps (`docs/archived/4.0/docs/examples/programming-languages/Quick installation of Java Apps.md`)

# Quick installation of Java Apps

First, make sure you have installed the following tools:

- Docker
- Maven

## Step 1: Write Your Java Program

- Here, directly generate a basic Spring Boot project through [Spring Initializr](https://start.spring.io/).



- Open the project's `pom.xml` file and add the following content to the `<dependencies>` section to include the MySQL JDBC driver:

  ```
  <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
  </dependency>
  ```

- Next, add the following content to the `application.properties` file in the `src/main/resources` directory to configure the database connection:

  ```
  spring.datasource.url=jdbc:mysql://localhost:3306/test_db?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8
  spring.datasource.username=root
  spring.datasource.password=your_password
  spring.jpa.hibernate.ddl-auto=update
  ```

## Step 2: Create Entity and Repository Classes

Create a new Java class in the project, such as `Person.java`, to represent the entity in the database. Add the following content:

```java
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;

    // Getters and setters
    // ...
}
```

- Then create a repository interface, such as `PersonRepository.java`:

  ```java
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface PersonRepository extends JpaRepository<Person, Long> {
  }
  ```

## Step 3: Create a Web Controller

- In the `src/main/java` directory of the project, create a simple web controller. For example, create a file named `PersonController.java` and add the following content:

```java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class PersonController {
    @Autowired
    private PersonRepository personRepository;

    @GetMapping("/getPersons")
    public String getAllPersons() {
        List<Person> persons = personRepository.findAll();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < persons.size(); i++) {
            sb.append("id: " + persons.get(i).getId() + " name: " + persons.get(i).getName() + "/n");
        }
        System.out.println(sb.toString());
        return sb.toString();
    }

    @PostMapping(value = "/addPerson")
    public Person addPerson(@RequestBody Person person) {
        return personRepository.save(person);
    }


}
```

## Step 4: Build the Application

- Build the project using Maven by running the following command:

  ```
  mvn clean install
  ```



## Step 5: Create a Docker Image

- In the root directory of the Java project, create a file named `Dockerfile`. This file will contain the instructions required to build the Docker image. Here's a simple example Dockerfile:

  ````
  # Use the official OpenJDK image as the base image
  FROM openjdk:8-jre-slim
  
  # Set the working directory
  WORKDIR /app
  
  # Copy the built JAR file into the image
  COPY target/demo-0.0.1-SNAPSHOT.jar /app/demo-0.0.1-SNAPSHOT.jar
  
  # Expose the application's port
  EXPOSE 8080
  
  # Set the start command
  CMD ["java", "-jar", demo-0.0.1-SNAPSHOT.jar"]
  ```
  ````

- In the project root directory, run the following command to build the Docker image:

```
docker build -t java-demo .
```

## Step 6: Push the Docker Image

- Push the created Docker image to a Docker repository, such as Docker Hub or a private repository. **Assuming you are already logged in to the Docker repository**, use the following command to push the image:

  - First, tag the Docker image. Before pushing an image, you need to add a tag to it so that Docker knows where to push it. Run the following command to add a tag to the image:

    ```
    docker tag your-image-name your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-image-name` with your local image name, `your-dockerhub-username` with your Docker Hub username, `your-repo-name` with the repository name you want to create on Docker Hub, and `your-tag` with the tag you set for the image (e.g., `latest`).

  - Then, push the tagged image to the Docker repository:

    ```
    docker push your-dockerhub-username/your-repo-name:your-tag
    ```

## Step 7: Log in to Sealos

- Visit the [Sealos](https://cloud.sealos.io/) official website



## Step 8: Open the "Database" application



## Step 9: Create a database

- Click on "Create New Database"



- Basic configuration:
  - Cluster type: mysql
  - Cluster name: demo-db
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
  - Number of instances: 1
  - Storage capacity: 1 Gi
- Click "Deploy Cluster"

## Step 10: Configure the database



- Click on "One-click Connect to Database" and execute the following statements:

  - Create the `test_db` database

    ```sql
    create database test_db;
    ```

  - Create the `test` table

    ```sql
    CREATE TABLE `name_info` (
      `id` int(11) NOT NULL,
      `name` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id`)
    );
    ```

  - Insert data

    ```sql
    insert into test values (1,'Sealos');
    ```

## Step 11: Open the "App Launchpad" application



## Step 12: Create a new application

- In "App Launchpad", click on "Create New Application" to create a new application.



## Step 13: Deploy the application

- Basic configuration:
  - Application name (custom): java-demo
  - Image name: damager6666/java-demo:v2
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
- Deployment mode:
  - Number of instances (custom): 1



- Network configuration:
  - Exposed container port: 8080
  - Public network access: enabled



## Step 14: Deploy the application

- Click on "Deploy Application" to start deploying the application.



## Step 15: Access the application

- Click on "Application Management" to view the application. When the application's STATUS changes from Pending to Running, it indicates that the application has started successfully.
- When the STATUS is Running, you can directly access the public network address.



- Enter the following in your browser:

```
https://tmgkflgdlstl.cloud.sealos.io/getPersons
```



- The page displays the data inserted into the database earlier, indicating that your Java application is now running on Sealos.

---

### Archived 4.0 Docs Examples Programming Languages Quick Installation Of Node.Js Apps (`docs/archived/4.0/docs/examples/programming-languages/Quick installation of Node.js Apps.md`)

# Quick installation of Node.js Apps

First, make sure you have installed the following tools:

- Docker

## Step 1: Write your Node.js program

- Create a file named `app.js` in your directory and add the following code:

  ```js
  const express = require('express');
  const mysql = require('mysql');
  const app = express();
  
  const db = mysql.createConnection({
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME,
  });
  
  db.connect((err) => {
    if (err) throw err;
    console.log('Connected to the database.');
  });
  
  app.get('/', (req, res) => {
    db.query('SELECT id, name FROM users', (err, results) => {
      if (err) throw err;
      res.send(JSON.stringify(results));
    });
  });
  
  app.listen(8080, () => {
    console.log('Server is running on port 8080');
  });
  ```

- Create a file named `package.json` in the root directory of your project, and include the following content:

  ~~~json
  {
    "name": "nodejs-web-app-mysql",
    "version": "1.0.0",
    "main": "app.js",
    "scripts": {
      "start": "node app.js"
    },
    "dependencies": {
      "express": "^4.17.1",
      "mysql": "^2.18.1"
    }
  }
  ```
  ~~~

## Step 2: Create a Docker image

- In the root directory of your project, create a file named `Dockerfile`. This file will contain the instructions needed to build the Docker image. Here is a simple example Dockerfile:

```dockerfile
FROM node:16

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 8080

CMD ["npm", "start"]
```

## Step 3: Build the Docker image

- Run the following command in the directory containing the `Dockerfile` to build the Docker image:

  ```
  docker build -t nodejs-demo .
  ```

## Step 4: Push the Docker image

- Push the created Docker image to a Docker repository, such as Docker Hub or a private repository. **Assuming you have logged in to the Docker repository**, use the following command to push the image:

  - First, tag the Docker image. Before pushing the image, you need to add a tag to it so that Docker knows where to push it. Run the following command to add a tag to the image:

    ```
    docker tag your-image-name your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-image-name` with the name of your local image, `your-dockerhub-username` with your Docker Hub username, `your-repo-name` with the name of the repository you want to create on Docker Hub, and `your-tag` with the tag you set for the image (e.g. latest).

    For example:

    ```
    docker tag nodejs-demo damager6666/nodejs-demo:v1
    ```

  - Next, push the Docker image. Use the following command to push the image to Docker Hub:

    ```
    docker push your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-dockerhub-username`, `your-repo-name`, and `your-tag` with the actual values. For example:

    ```
    docker push damager6666/nodejs-demo:v1
    ```

## Step 5: Login to Sealos

- Go to the [Sealos](https://cloud.sealos.io/) website.



## Step 6: Open the "Database" application



## Step 7: Create a database

- Click on "Create a database"



- Basic configuration:
  - Cluster type: mysql
  - Cluster name: demo-db
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
  - Number of instances: 1
  - Storage capacity: 1 Gi
- Click "Deploy Cluster"

## Step 8: Configure the database



- Click "Connect to the database" to execute the following statements:

  - Create a database named test_db

    ```sql
    create database test_db;
    ```

  - Create a table named test

    ```sql
    CREATE TABLE `name_info` (
      `id` int(11) NOT NULL,
      `name` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id`)
    );
    ```

  - Insert some data

    ```sql
    insert into test values (1,'Sealos');
    ```

## Step 9: Open the "App Launchpad" application



## Step 10: Create a new application

- In App Launchpad", click "Create New Application" to create a new application.



## Step 11: Deploy the application

- Basic configuration:
  - Application name (customizable): nodejs-demo
  - Image name : damager6666/nodejs-demo:v1
  - CPU (recommended): 1 core
  - Memory (recommended): 1 G
- Deployment mode:
  - Number of instances (customizable): 1



- Network configuration:
  - Exposed container port: 8080
  - External network access: enabled



## Step 12: Deploy the application

- Click "Deploy Application" to start deploying the application.



## Step 13: Access the application

- Click "App Launchpad" to view the application status. When the STATUS changes from Pending to Running, it means that the application has been successfully launched.
- When the STATUS is Running, you can directly access the external network address.



- Enter the following URL in your browser:

```
https://tmgkflgdlstl.cloud.sealos.io/getPersons
```



- The page will display the data inserted into the database, indicating that your Node.js application is running on Sealos.

---

### Archived 4.0 Docs Examples Programming Languages Quick Installation Of Python Apps (`docs/archived/4.0/docs/examples/programming-languages/Quick installation of Python Apps.md`)

# Quick installation of Python Apps

First, make sure you have the following tools installed:

- Docker

## Step 1: Write your Python program

- Create a file named `app.py` in your project directory and add the following code:

  ```python
  from flask import Flask, render_template
  import mysql.connector
  
  app = Flask(__name__)
  
  def get_data_from_database():
      cnx = mysql.connector.connect(
          host="java-demo-db-mysql.ns-7otl3mb2.svc",
          user="root",
          password="l9h8f24b",
          database="test_db"
      )
  
      cursor = cnx.cursor()
      cursor.execute("SELECT * FROM test")
      data = cursor.fetchall()
      cursor.close()
      cnx.close()
  
      return data
  
  @app.route('/')
  def index():
      data = get_data_from_database()
      return render_template('index.html', data=data)
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0', debug=True)
  
  ```

- Create a file named `requirements.txt` in the directory to list the dependencies required by the application.

```
Flask
mysql-connector-python
```

- Create a folder named `templates` in your project directory and create a file named `index.html` inside it. Add the following content to `index.html`:

  ```html
  <!doctype html>
  <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>Data from MySQL</title>
    </head>
    <body>
      <h1>Data from MySQL</h1>
      <table>
        <tr>
          <th>Column1</th>
          <th>Column2</th>
          <th>Column3</th>
        </tr>
        {% for row in data %}
          <tr>
            <td>{{ row[0] }}</td>
            <td>{{ row[1] }}</td>
            <td>{{ row[2] }}</td>
          </tr>
        {% endfor %}
      </table>
    </body>
  </html>
  
  Replace `Column1`, `Column2`, and `Column3` with the actual column names you want to display.
  ```

## Step 2: Create a Docker image

- Create a file named `Dockerfile` in the root directory of the project. This file will contain the instructions needed to build the Docker image. Here is a simple example Dockerfile:

  ```dockerfile
  FROM python:3.8
  
  WORKDIR /app
  
  COPY requirements.txt .
  
  RUN pip install --no-cache-dir -r requirements.txt
  
  COPY . .
  
  EXPOSE 5000
  
  CMD ["python", "app.py"]
  ```

## Step 3: Build the Docker image

- Run the following command in the directory containing the `Dockerfile` to build the Docker image:

  ```
  docker build -t python-demo .
  ```

## Step 4: Push the Docker image

- Push the created Docker image to a Docker repository, such as Docker Hub or a private repository. **Assuming that you have logged in to the Docker repository**, use the following command to push the image:

  - First, tag the Docker image. Before pushing the image, you need to add a tag to it so that Docker knows where to push it. Run the following command to add a tag to the image:

    ```
    docker tag your-image-name your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-image-name` with your local image name, `your-dockerhub-username` with your Docker Hub username, `your-repo-name` with the name of the repository you want to create on Docker Hub, and `your-tag` with the tag you set for the image (e.g. latest).

    For example:

    ```
    docker tag python-demo damager6666/python-demo:v1
    ```

  - Next, push the Docker image. Use the following command to push the image to Docker Hub:

    ```
    docker push your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-dockerhub-username`, `your-repo-name`, and `your-tag` with the actual values. For example:

    ```
    docker push damager6666/python-demo:v1
    ```

## Step 5: Log in to Sealos

- Go to the [Sealos](https://cloud.sealos.io/) website.



## Step 6: Open the "Database" application



## Step 7: Create a database

- Click "Create Database"



- Basic Configuration:
  - Cluster Type: mysql
  - Cluster Name: demo-db
  - CPU (Recommended): 1 Core
  - Memory (Recommended): 1 G
  - Number of Instances: 1
  - Storage Capacity: 1 Gi
- Click "Deploy Cluster"

## Step 8: Configure the database



- Click "Connect to the Database" and execute the following SQL statements:

  - Create the test_db database

    ```sql
    create database test_db;
    ```

  - Create the test table

    ```sql
    CREATE TABLE `name_info` (
      `id` int(11) NOT NULL,
      `name` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id`)
    );
    ```

  - Insert data

    ```sql
    insert into test values (1,'Sealos');
    ```

## Step 9: Open the "App Management" application



## Step 10: Create a new app

- In "App Management", click "New App" to create a new app.



## Step 11: App deployment

- Basic Configuration:
  - Application Name (Customized): python-demo
  - Image Name: damager6666/python-demo:v1
  - CPU (Recommended): 1 Core
  - Memory (Recommended): 1 G
- Deployment Mode:
  - Number of Instances (Customized): 1



- Network Configuration:
  - Container Exposed Port: 5000
  - External Access: Enabled



## Step 12: Deploy the app



## Step 13: Access the app

- Click "App Management" to check when the STATUS of the app changes from "Pending" to "Running", indicating that the app has been successfully launched.
- When the STATUS is Running, you can directly access the external network address.



- Enter the external network address in the browser to access the data that was just stored in MySQL, indicating that the program has been successfully deployed on Sealos.

  ```http
  https://mkqreaqfgwac.cloud.sealos.io/
  ```

---

### Archived 4.0 Docs Examples Programming Languages Quick Installation Of Vue Apps (`docs/archived/4.0/docs/examples/programming-languages/Quick installation of Vue Apps.md`)

# Quick installation of Vue Apps

First, make sure you have installed the following tools:

- Docker
- Node.js
- npm

## Step 1: Install Vue CLI

```bash
npm install @vue/cli
```

## Step 2: Create a new project with Vue CLI

```bash
vue create my-vue-app
```

## Step 3: Build the production version of the project with Vue CLI

```bash
cd my-vue-app
npm run build
```

## Step 4: Create a Docker image

- In the `my-vue-app` directory, create a file named `Dockerfile` with the following content:

```dockerfile
# 使用 nginx 镜像作为基础镜像
FROM nginx:1.21-alpine

# 复制构建的前端文件到 nginx 容器中
COPY dist/ /usr/share/nginx/html

# 暴露端口
EXPOSE 80

# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]
```

- Run the following command in the directory where the `Dockerfile` is located to build a Docker image for the Vue application:

```bash
docker build -t my-vue-app .
```

## Step 5: Push Docker Image

- Push the created Docker image to a Docker repository, such as Docker Hub or a private repository. **Assuming you are already logged in to the Docker repository**, use the following command to push the image:

  - First, tag the Docker image. Before pushing an image, you need to add a tag to it so that Docker knows where to push it. Run the following command to add a tag to the image:

    ```
    docker tag your-image-name your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-image-name` with your local image name, `your-dockerhub-username` with your Docker Hub username, `your-repo-name` with the repository name you want to create on Docker Hub, and `your-tag` with the tag you set for the image (e.g., latest).

    For example:

    ```
    docker tag my-vue-app damager6666/my-vue-app:v1
    ```

  - Next, push the Docker image. Use the following command to push the image to Docker Hub:

    ```
    docker push your-dockerhub-username/your-repo-name:your-tag
    ```

    Replace `your-dockerhub-username`, `your-repo-name`, and `your-tag` with the actual values. For example:

    ```
    docker push damager6666/my-vue-app:v1
    ```

## Step 6: Log in to Sealos

- Go to the [Sealos](https://cloud.sealos.io/) official website



## Step 7: Open the "App Launchpad" App



## Step 8: Create a New Application

- In "App Launchpad", click "Create New Application" to create a new application.



## Step 9: Application Deployment

- Basic Configuration:
  - Application Name (custom): my-vue-app
  - Image Name: damager6666/my-vue-app:v1
  - CPU (recommended): 1 Core
  - Memory (recommended): 1 G
- Deployment Mode:
  - Number of Instances (custom): 1



- Network Configuration:
  - Container Exposed Port: 80
  - Internet Access: Enable



## Step 10: Deploy Application

- Click "Deploy Application" to start deploying the application.



## Step 11: Access Application

- Click "Application Management" to view. When the application's STATUS changes from Pending to Running, it means the application has started successfully.
- When STATUS is Running, you can directly access the external network address.



- In the browser, enter

```
https://mvpztqzczudy.cloud.sealos.io
```

)

- The page displays "Hello, Vue.js!", indicating that your Vue application is running on Sealos.

---

### Archived 4.0 Docs Examples Social Communication Install Tailchat (`docs/archived/4.0/docs/examples/social-communication/install-tailchat.md`)

# Quick installation of Tailchat

[Tailchat](https://tailchat.msgbyte.com/) is an open source IM application that is pluggable and easy to expand. Plugin architecture gives Tailchat unlimited possibilities.

Front-end micro-kernel architecture + back-end micro-service architecture makes Tailchat to control any customized/privatized scenarios

Created for enterprises and private domain users, highly free group management and customized panel display allow private domain owners to better display their works, manage users, and build their own brand and circle.



## First, enter Sealos and open "Application Management"



## Create a new application



### Create dependencies

As an enterprise-level application, `tailchat` has the minimum dependencies of `mongodb`, `redis`, and `minio`. Let's create them one by one.

#### MongoDB

For convenience, we will fix one instance and bind it to local storage. The image used is `mongo:4`. Note that because we did not set a password for the database, do not provide network services to the public network. The container exposes port 27017, which is the default database service port. The content is as follows:



Click "Deploy Application" to submit the deployment. Wait patiently for a while, and you can see that the application has started up.



> Note: that the initial allocation of 64m is too small for MongoDB, so I changed it to 128m by modifying the application. Resource allocation can be changed at any time, which is also a convenient feature of Sealos/Kubernetes.

#### Minio

Next, we will create Minio, an open-source object storage service. We can also quickly create it through Sealos's UI. The image used is `minio/minio`. Note that we need to make some adjustments:

- Expose port: 9000
- Change the run command to: `minio`
- Change the command parameters to: `server /data`
- Set environment variables:
  - MINIO_ROOT_USER: tailchat
  - MINIO_ROOT_PASSWORD: com.msgbyte.tailchat
- Local storage: `/data`

The final result is as follows:



Click the "Deploy" button and you can see that the service has started up normally.

#### Redis

Finally, we need to deploy Redis as a content cache and message forwarding. The image used is `redis:alpine`, and the exposed port is `6379`. The final result is as follows:



### Create Tailchat itself

At this point, all the dependencies required by Tailchat have been deployed, as shown below:



Now we can deploy the Tailchat itself. The Tailchat itself will be relatively complex, but because Sealos is purely UI-based, it will not be too complicated.

- Use image: `moonrailgun/tailchat`
- Expose port: `11000` (remember to open external access)
- Configure environment variables as follows:
  ```
  SERVICEDIR=services,plugins
  TRANSPORTER=redis://redis:6379
  REDIS_URL=redis://redis:6379
  MONGO_URL=mongodb://mongo/tailchat
  MINIO_URL=minio:9000
  MINIO_USER=tailchat
  MINIO_PASS=com.msgbyte.tailchat
  ```

The final effect is as follows:



After waiting patiently for a while, you can see that the Tailchat service has started up.



## Preview service

First, we can check the availability of the Tailchat service by adding `/health` to the external address provided by the service, such as `https://<xxxxxxxxxx>.cloud.sealos.io/health`. When it starts up, the Tailchat service will return content like this:



This JSON string contains the image version used, node name, system usage, and microservice loading status. Here we can see that my common services, such as `user`/`chat.message`, and some services with plugin prefixes such as `plugin.registry`, have all started up normally, indicating that our server is running normally. Now we can directly access our external address and see that after a short loading time, the page opens normally and automatically jumps to the login page.



Register an account casually, and you can see that we can enter the main interface of Tailchat normally, as shown in the following figure:



At this point, our service has successfully landed in Sealos.

## Scaling service

Of course, as a distributed architecture system, Tailchat naturally supports horizontal scaling. In Sealos, scaling is also very simple. Just modify the number of instances through the change operation:







At this point, when we access `https://<xxxxxxxxxx>.cloud.sealos.io/health`, we can see that we can access different nodes.



## Add Tailchat entry to desktop

Open Terminal, enter `vim app.yml` to create and edit a configuration file

Enter the following content, note that the url should be replaced with the url deployed by yourself

```yml
apiVersion: app.sealos.io/v1
kind: App
metadata:
  name: tailchat-app-entry
spec:
  name: Tailchat
  icon:
  type: iframe
  data:
    url: <Your url>
    desc:
  icon: https://tailchat.msgbyte.com/img/logo.svg
  menuData:
  displayType: normal
```

Press `esc` to exit edit mode, press `:wq` to save and exit vim

Type `kubectl apply -f app.yml` to start the configuration.

After refreshing the page, we can see that our entry appears on the desktop of `sealos`

---

### Archived 4.0 Docs Guides Applaunchpad Add Domain (`docs/archived/4.0/docs/guides/applaunchpad/add-domain.md`)

---
sidebar_position: 2
---

# Add a domain

Assigning a custom domain to your project guarantees that visitors to your application will have a tailored experience that aligns with your brand.

## When Deploying

Just enable "Public Access" when you're deploying, and [Sealos](https://cloud.sealos.io) will sorts you out with a domain.



Now, on your domain provider's end, link the 'CNAME' to the one Sealos provided.

Once it's active, jump back to Sealos, click on "Custom Domain" to the side:



Enter your custom domain in the pop-up box and click confirm.



To wrap up, click the "Deploy" button. Once your app's live, click on the external address to access the app via the custom domain.

## Post Deployment

For the apps you've deployed, just click "Update" top-right on the app details page. Then, follow the earlier steps to integrate your custom domain.

---

### Archived 4.0 Docs Guides Applaunchpad Applaunchpad (`docs/archived/4.0/docs/guides/applaunchpad/applaunchpad.md`)

---
sidebar_position: 1
---

# App Launchpad

**App Launchpad** is a feature within Sealos that serves as a single-image deployment tool. Its main goal is to streamline and expedite the process of deploying applications, allowing you to launch your application in as little as 5 minutes.

The tool currently boasts a range of functionalities:

- Capability to deploy applications using private images.
- Flexibility to tailor CPU and memory resources according to the specific needs of the application.
- Support for deploying multiple replicas.
- Horizontal Pod Autoscaling (HPA) for dynamic scaling.
- Provision of external URLs for easy access from the public network.
- Option to assign custom domain to applications, enhancing both brand visibility and the user experience.
- Utilization of ConfigMap for configuration file management.
- Persistent storage solutions for application data, ensuring both its security and continuity.
- Real-time monitoring features for applications and Pods to facilitate prompt issue detection and resolution.
- Comprehensive logging of application activities, aiding in troubleshooting and performance optimization.
- Analysis of system events (Events) to extract critical insights for enhancing application performance.
- A convenient one-click feature to access the container terminal, simplifying management and debugging tasks.
- Ability to expose several ports of an application to the external network.

## [Quick Start](/quick-start/use-app-launchpad.md)

For quick and easy installation of commonly utilized applications.

## [Update Application](/guides/applaunchpad/update-app.md)

Guidance on modifying application configurations after initial deployment.

## [Add a domain](/guides/applaunchpad/add-domain.md)

Instructions for integrating a custom domain with your application.

## [Exposing Multiple Ports](/guides/applaunchpad/expose-multi-ports.md)

Details on how to make multiple ports of an application accessible externally.

## [Environment](/guides/applaunchpad/environment.md)

Directions for configuring applications through the use of environment variables.

## [ConfigMap](/guides/applaunchpad/configmap.md)

Guidelines for setting up application configurations via configuration files.

## [Autoscaling](/guides/applaunchpad/autoscale.md)

Strategy for autoscaling the number of application instances in response to varying workloads.

## [Persistent Volume](/guides/applaunchpad/persistent-volume.md)

Utilizing persistent storage for the long-term preservation of data.

---

### Archived 4.0 Docs Guides Applaunchpad Autoscale (`docs/archived/4.0/docs/guides/applaunchpad/autoscale.md`)

---
sidebar_position: 6
---

# Autoscaling

In [Sealos](https://cloud.sealos.io), the "[App Launchpad](/guides/applaunchpad/applaunchpad.md)" feature enables the automatic adjustment of application instance numbers to effectively respond to varying load conditions. This functionality is known as "**Autoscaling**," or more technically, the Horizontal Pod Autoscaler (HPA).

Autoscaling operates by dynamically altering the count of application instances based on specific metrics like CPU and memory usage. This ensures that the applications run efficiently and resources are optimally utilized.

> Key Point: In Autoscaling, "usage" typically refers to the average use across all instances of an application. For example, if an app runs on two instances, its average CPU usage is calculated as the mean of the usage of these two instances.

The workings of Autoscaling are as follows:

1. **Monitoring**: It continuously monitors crucial performance indicators like CPU and memory usage.
2. **Decision Making**: Based on predefined thresholds (e.g., maintaining CPU usage below 50%), it calculates the required adjustments in the instance count.
3. **Adjustment**: Following this, Autoscaling automatically instructs the Sealos controller to modify the number of instances, ensuring the usage stays within the desired range.

For instance, if we set up an application with specific Autoscaling rules such as a maximum CPU usage of 50% and the ability for instance numbers to vary between 1 and 5, Autoscaling will:

- Increase the number of instances when the average CPU usage exceeds 50%, up to a maximum of 5.
- Decrease the number of instances when the average CPU usage drops below 50%, but always maintain at least one instance in operation.

---

### Archived 4.0 Docs Guides Applaunchpad Configmap (`docs/archived/4.0/docs/guides/applaunchpad/configmap.md`)

---
sidebar_position: 5
---

# ConfgMap

In [Sealos](https://cloud.sealos.io), the implementation of configuration files plays a vital role, particularly when the application deals with numerous or complex configurations. Differing from environment variables, configuration files are a more versatile and dependable means for managing settings. Environment variables are more apt for simple, small-scale configuration tasks.

The primary strength of configuration files is their capability to hold and control elaborate configuration data, including aspects like configuration files, command-line arguments, and environment variables. These pieces of data can be incorporated into the container upon the launch of the application container, facilitating adjustments to the application's functionalities without the necessity of recompiling the image.

Take, for example, the Nginx container. The utilization of configuration files in this context can be described as follows:

- **Filename**: This pertains to a file within the Nginx container, for which references can be drawn from the instructions provided by the image supplier.
- **File Value**: This is the content corresponding to the file. In cases where the content is elaborate, it's recommended to complete editing it offline and then paste it into the specified location.
- **Key Points**: The approach involves mounting an individual file, not an entire directory. It is imperative to precisely identify the file to be mounted, rather than just a directory path.

---

### Archived 4.0 Docs Guides Applaunchpad Environment (`docs/archived/4.0/docs/guides/applaunchpad/environment.md`)

---
sidebar_position: 4
---

# Environment

In [Sealos](https://cloud.sealos.io), environment variables are pivotal in managing the configuration data for container applications. These variables enable the provision of essential configuration information to applications without necessitating changes to the application's code or image, thus bolstering their maintainability and scalability.

The process of defining environment variables in the "[App Launchpad](/guides/applaunchpad/applaunchpad.md)" interface is streamlined through a bulk input method. Users can define multiple variables by entering them line by line. Each variable comprises a key and a value, separated by either an equal sign (=) or a colon (:). The interface is designed to automatically eliminate any invalid characters from the key, ensuring the accuracy and validity of the environment variables.



**Environment Variable Formats That Are Correctly Interpreted:**

```shell
host=127.0.0.1
port:3000
name: sealos
- username=123
- password:123
# Comments like this line are ignored, as they don't include an equal sign (=) or a colon (:), which are the key markers.
```

**Environment Variable Formats That Cannot Be Interpreted:**

```shell
host=127.0.0.1 # This line is interpreted because it contains an equal sign (=) or a colon (:). The comment here is also considered part of the variable due to the preceding equal sign (=).
```

---

### Archived 4.0 Docs Guides Applaunchpad Expose Multi Ports (`docs/archived/4.0/docs/guides/applaunchpad/expose-multi-ports.md`)

---
sidebar_position: 3
---

# Exposing Multiple Ports

In complex application environments, it's common for services to expose multiple ports simultaneously to cater to diverse needs. These requirements can emerge from various scenarios:

+ **Multi-protocol support**: For example, an application might support both HTTP and HTTPS, necessitating the exposure of both ports 80 and 443.
+ **Multi-functional application**: An application might have a web service and an admin service, both of which listen on different ports.
+ **Compatibility considerations**: To remain compatible with older versions or other services, you might need to expose ports for both the new and old interfaces.
+ **Combined Database + App**: For instance, if you have an application and a database within the same Pod, you might need to expose ports for both the application and the database.
+ **Prometheus Monitoring and App Service**: If your application has a business port and another port for Prometheus monitoring via `/metrics`, you might need to expose both.
+ **Coexistence of GRPC and RESTful services**: If your application offers both GRPC and RESTful services, you might need to expose separate ports for each type of service.

When deploying applications using "[App Launchpad](/guides/applaunchpad/applaunchpad.md)" on [Sealos](https://cloud.sealos.io), you can easily choose to expose multiple ports. During the deployment process, users simply click on the "Network" option and then select "Add Port" to configure multiple ports.



Furthermore, the Sealos platform offers external access to these ports. Once exposed to the public network, each port will be assigned a unique sub-domain, facilitating easier remote access and management.

---

### Archived 4.0 Docs Guides Applaunchpad Persistent Volume (`docs/archived/4.0/docs/guides/applaunchpad/persistent-volume.md`)

---
sidebar_position: 7
---

# Persistent Volume

[Sealos](https://cloud.sealos.io) offers a flexible environment where containers can be effortlessly created and destroyed. This flexibility is advantageous for application deployment and management, but it also raises the issue of maintaining data persistence. In scenarios where data is stored within an application container, its destruction leads to the loss of all stored data.

To counter this problem, the use of persistent storage is essential. Persistent storage ensures that data is stored externally, thereby preserving it even through container restarts or redeployments. This is particularly vital for applications requiring data retention, like databases, file storage systems, or any services involving user data.

For instance, in deploying Nextcloud, all data associated with its container is located in the `/var/www/html` directory. To maintain data continuity, it's necessary to use external storage solutions for persisting data in this directory.

---

### Archived 4.0 Docs Guides Applaunchpad Set Cert (`docs/archived/4.0/docs/guides/applaunchpad/set-cert.md`)

---
sidebar_position: 8
---

# Set a Custom Domain Certificate

Successfully set up a custom domain in "App Launchpad" but cannot access the domain, and it shows the certificate is not
secure. This is because cert-manager did not successfully issue the certificate. To resolve this issue, we can manually
set up the certificate.

First, make sure you have successfully set up CNAME in your cloud provider and have downloaded the certificate
corresponding to your domain.

Open "App Launchpad", set a custom domain.



Open the "Terminal", and execute the following commands in sequence.

```bash
# Create tls.crt using the certificate file information (replace xxxx with the actual certificate file information).
cat > tls.crt <<EOF
-----BEGIN CERTIFICATE-----
xxxx
-----END CERTIFICATE-----
EOF

# Create tls.key using the certificate private key information (replace xxxx with the actual private key information).
cat > tls.key <<EOF
-----BEGIN RSA PRIVATE KEY-----
xxxx
-----END RSA PRIVATE KEY-----
EOF

# Create a secret using tls.crt and tls.key.
kubectl create secret tls network-test --cert tls.crt --key tls.key

# Check the ingress for the corresponding application.
kubectl get ingress 
```



Modify the ingress (replace xzy-dev.sealos.run with your own custom domain).

```bash
kubectl patch ingress network-twvuqmjzckur -p '{"spec":{"tls":[{"hosts":["xzy-dev.sealos.run"],"secretName":"network-test"}]}}'
```



Test the effect.

---

### Archived 4.0 Docs Guides Applaunchpad Update App (`docs/archived/4.0/docs/guides/applaunchpad/update-app.md`)

---
sidebar_position: 1
---

# Update app

After deploying an application on [Sealos](https://cloud.sealos.io), you can update the application settings at any time. Just click the "Update" button at the top-right of the app details page. When you're done, click on the "Update" button at the top-right.

---

### Archived 4.0 Docs Guides Dbprovider Dbprovider (`docs/archived/4.0/docs/guides/dbprovider/dbprovider.md`)

---
sidebar_position: 2
---

# Database

** Database ** is the core component of an application, Sealos provides a database cluster deployment management tool, can help you quickly deploy database clusters. It supports MySQL, PostgreSQL, MongoDB, Redis, Kafka, and more. Currently the ** database ** supports the following features.

+ Elastic expansion
+ Support multi-version and multi-type databases
+ Database connection: one-click connection, external network access
+ Database connection: manual backup, automatic backup
+ Database monitoring: resource, status, and performance monitoring
+ Database migration: public network migration and file migration
+ Database high availability: Supports multiple database instances
+ Visual database management: Create, delete, update, pause, restart the database


## Quick start

Take deploying a PostgreSQL database as an example to experience the convenience of a database.

Deployment and access in just 6 steps:

1. Enter the Database application from the [Sealos](https://cloud.sealos.io) desktop：



2. Click on the creation of a new cluster.：



3. Select the corresponding database and parameters：



4. Click on deployment：



5. Enter DB to view details：



6. Database details：
















## Database connection

### One-click connection

1. Enter ** database **, click Connect:



2. Manipulate the database at the terminal：




### Extranet access

1. Enter ** database **, click Connect：



2. Confirm open ** database **：



3. Copy the database connection information：



4. Connect to the database in the Database Connection tool：






## Database backup

### Manual backup
1. Enter the database backup page, click Backup：



2. Enter the backup information to start the backup：



3. Check Backup status：






### Automatic backup
1. Enter the database backup page, click Backup：



2. Enable automatic backup and enter backup information：




## Database migration

This section uses the MySQL database as an example to describe how to migrate a database.

### Public network migration

Public network migration involves two databases: the source database and the target database. The source database is the data source for migration, and the target database is the data destination for migration. The following introduction demonstrates the local database as the source database.

1. Enter the target database and connect to the target database：



2. Create the corresponding database in the terminal interface (skip this step if the corresponding database already exists)：


```bash
# Example of creating a database sql statement：
$ create database testmysql;
```

3. Enter the public network migration page of the target database, click the Migrate button：



4. View migration configuration information：



Copy the migration configuration information as follows：
```bash
# Example of an sql statement for setting configuration information：
$ set global binlog_format=ROW;
$ set binlog_row_image ='FULL';
```

5. Set the configuration information in the source database (MySQL and Postgres require manual configuration information, Mongo does not require configuration)：
```bash
# xample of an sql statement for setting configuration information：
$ set global binlog_format=ROW;
$ set binlog_row_image ='FULL';
```


6. Enter the target database, fill in the migration information of the source database, which tables to migrate, and fill in which database in the target database to migrate：



If you need to continuously migrate data from the source database, enable continuous migration in the advanced configuration as follows：



7. View migration task information：



8. Enter the target database, connect to the target database, and check whether the migration data is complete：



### File migration

1. Enter the target database and connect to the target database：



2. Create the corresponding database in the terminal interface (skip this step if the corresponding database already exists)：
```bash
# Example of creating a database sql statement：
$ create database testmysql;
```


3. Upload the migration file, enter the database name, and start the migration：



4. File migrating, Wait for the migration result：





5. Connect to the database to check whether the migrated data is complete：

---

### Archived 4.0 Docs Guides Objectstorage Objectstorage (`docs/archived/4.0/docs/guides/objectstorage/objectstorage.md`)

---
sidebar_position: 0
---

# Object Storage

**Object Storage** is Sealos' built-in object storage service, which is primarily used to store and manage unstructured
data.

Currently, **Object Storage** has the following features:

- Upload files to bucket
- Download files from bucket
- Expose the access permission of the bucket
- Use SDK to access bucket
- Monitors bucket resource metrics
- Static host

## Quick start

### Upload files to bucket

Go to Object Storage


Create a bucket


Set bucket name to test and permission to private


Bucket is created successfully


Upload file


File uploaded successfully


### Expose the access permission of the bucket

Click the Edit button


Set Bucket Permission to publicRead and click the Application button


Copy file link


Paste to browser address bar to access files


### View the access key configuration

An Object Storage user consists of a unique access key (username) and corresponding secret key (password). Internal is
the internal access address of Object Storage, and External is the external access address of Object Storage.


### Use SDK to access bucket

The SDK requires three parameters to access bucket: AccessKey, SecretKey, and Endpoint (Internal or External). If the
Region parameter is required, us-east-1 is used by default.

#### Go Client SDK

Detailed documentation reference: https://min.io/docs/minio/linux/developers/go/API.html

Example: Use the Go Client SDK to upload the style.css file to the sv3dd7u4-test bucket, and set the endpoint to the
external address. If the service is deployed in the K8s cluster, you can change the endpoint to the internal address.

```go
package main

import (
	"context"
	"fmt"
	"log"
	"os"
)
import "github.com/minio/minio-go/v7"
import "github.com/minio/minio-go/v7/pkg/credentials"

func main() {
	endpoint := "objectstorageapi.xxx.xxx.xxx"
	accessKey := "xxxxxxxx"
	secretKey := "xxxxxxxxxxxxxxxx"
	// init minio client
	minioClient, err := minio.New(endpoint, &minio.Options{
		Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
	})
	if err != nil {
		log.Fatalln(err)
	}
	// get local file
	file, err := os.Open("./style.css")
	if err != nil {
		fmt.Println(err)
		return
	}
	defer file.Close()

	fileStat, err := file.Stat()
	if err != nil {
		fmt.Println(err)
		return
	}
	// put object
	uploadInfo, err := minioClient.PutObject(context.Background(), "sv3dd7u4-test", "style.css", file, fileStat.Size(), minio.PutObjectOptions{ContentType: "text/css"})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("Successfully uploaded bytes: ", uploadInfo)
}
```

File uploaded successfully


#### Java Client SDK

Detailed documentation reference: https://min.io/docs/minio/linux/developers/java/API.html

Example: Use the Java Client SDK to upload the style1.css file to the sv3dd7u4-test bucket, and set the endpoint to the
external address. If the service is deployed in the K8s cluster, you can change the endpoint to the internal address.

```xml

<dependency>
    <groupId>io.minio</groupId>
    <artifactId>minio</artifactId>
    <version>8.5.9</version>
</dependency>
```

```javascript
package org.example;

import io.minio.MinioClient;
import io.minio.UploadObjectArgs;

public class FileUploader {
    public static void main(String[] args) throws Exception {

        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint("https://objectstorageapi.xxx.xxx.xxx")
                        .credentials("xxxxxxxx", "xxxxxxxxxxxxxxxx")
                        .build();


        minioClient.uploadObject(
                UploadObjectArgs.builder()
                        .bucket("sv3dd7u4-test")
                        .object("style1.css")
                        .filename("src/main/java/org/example/style1.css")
                        .build());

        System.out.println("Successfully uploaded bytes.");
    }
}
```

File uploaded successfully


#### Omit other language SDK

Detailed documentation reference: https://min.io/docs/minio/linux/developers/minio-drivers.html

### Static host

Create a permission for publicRead/publicReadwrite bucket, click Enable Hosting.


Click on the address to jump to access.


Click Custom Domain.


In the Update area of App Launchpad, you can customize the domain.

---

### Archived 4.0 Docs Guides Templates Submit Template (`docs/archived/4.0/docs/guides/templates/submit-template.md`)

---
sidebar_position: 2
---

# Submit template

Every template in the Sealos template marketplace is directly and continuously updated from the [Sealos Template Repository](https://github.com/labring-actions/templates). For those interested in contributing new templates, the process involves submitting a Pull Request (PR) to this repository.

To craft a new template, reference is available in the form of the [template.yaml](https://github.com/labring-actions/templates/blob/main/template.yaml) file. The system is equipped with a variety of common environment variables and functions that are accessible during the template development process. These integrated features enable the use of syntax akin to `GitHub Actions`. For instance, environment variables such as `${{ SEALOS_NAMESPACE }}` can be utilized to configure specific parameters in the template. Comprehensive details about these built-in environment variables are available in the [Template Guidelines](https://github.com/labring-actions/templates/blob/main/example.md).

---

### Archived 4.0 Docs Guides Templates Templates (`docs/archived/4.0/docs/guides/templates/templates.md`)

---
sidebar_position: 0
---

# Templates

import Highlight from '@site/src/components/Highlight'

<Highlight content="Use a template" url="https://template.cloud.sealos.io" />

Sealos's [templates](https://template.cloud.sealos.io/) offers an array of pre-designed templates, ideal for quickly setting up and launching websites and a range of applications. This marketplace hosts a variety of template types, including blogs, AI applications, low-code solutions, cloud storage, IM applications, and middleware. These templates aim to make the development process more efficient, allowing developers to rapidly initiate and deploy projects without the need to build a website from scratch or concern themselves with the intricacies of application dependencies.

Contrasting with Vercel's template marketplace, Sealos provides a different range of applications and functionalities. Vercel primarily targets front-end project deployment, offering templates that enhance website interfaces and user interactions. However, Vercel does not offer persistent data storage, resulting in data being temporary and lost upon application restart.

In contrast, Sealos's application templates encompass both front-end and back-end projects, along with a variety of other applications. Significantly, Sealos includes support for persistent storage, an essential aspect for applications that require extensive data storage or need to maintain data continuity. This is particularly critical for applications like e-commerce websites, large-scale social media platforms, and enterprise-level applications, where data persistence is a key requirement.

---

### Archived 4.0 Docs Guides Terminal Terminal (`docs/archived/4.0/docs/guides/terminal/terminal.md`)

---
sidebar_position: 4
---

# Terminal

Integrated within the [Sealos](https://cloud.sealos.io) Cloud Operating System is the Terminal, an application of profound potency. Mirroring the terminal in standalone operating systems, it facilitates users to interact directly with the operating system, executing various operations via command entry.



The value of the Terminal rests in its efficiency, flexibility, and powerful capabilities. For a plethora of tasks, employing the Terminal proves swifter and more concise than utilizing a Graphical User Interface (GUI). It is an indispensable instrument for developers, permitting users to gain a profound understanding and control of the Sealos Cloud Operating System.

**Every user's Terminal is in fact operating within a Pod of Kubernetes**, which can be observed in the Terminal using the following command:



## Accessing the Terminal of an Application Container

One may directly access the Terminal of any application container via the Terminal App. Suppose you have deployed an application such as Nginx via application management, one can navigate directly to the Nginx application's detail page, click on the three dots on the right side of the details, and then click on 'Terminal' to access the Terminal of the Nginx application.





## 终端一键直连数据库

It is also possible to establish a direct connection to the database created in the[Database App](../dbprovider/dbprovider.md) with a single click via the Terminal.

Navigate to the database details page and click on '一键连接' on the left:



This will take you directly to the Terminal App and connect to the database:



## Direct Manipulation of Kubernetes Resources via Terminal

:::danger

The following operations necessitate foundational knowledge of Kubernetes and container-related concepts, avoid casual execution without this understanding.

:::

Veteran Kubernetes users can utilize the Terminal to manipulate Kubernetes resources directly, affording many advantages for such seasoned users:

+ Enables batch operations and automation
+ Offers high flexibility
+ Allows in-depth troubleshooting

Below are examples of common operations with Kubernetes resources within the Terminal:

+ View the list of user's Pods

```bash
kubectl get pods
```

+ Create and manage resource

```bash
# Create resources using YAML or JSON files
$ kubectl create -f <filename>

# Create or update resources using YAML or JSON files
$ kubectl apply -f <filename>

# Delete specified resource type and name
$ kubectl delete <resource-type> <resource-name>

# View the status of a specified Deployment's rolling update
$ kubectl rollout status deployment/<deployment-name>
```

+ Troubleshooting

```bash
# Obtain detailed information about a specific resource, including events and status
$ kubectl describe <resource-type> <resource-name>

# Obtain logs of a specific container in a specific Pod
$ kubectl logs <pod-name> -c <container-name>

# Open a terminal in a specific Pod for debugging purposes
$ kubectl exec -it <pod-name>
```

---

### Archived 4.0 Docs Guides Workspace Worksapce (`docs/archived/4.0/docs/guides/workspace/worksapce.md`)

---
sidebar_position: 5
---

# Team Collaboration and Workspace

## Term Definitions

### Workspace

Workspace is a core feature of the Sealos Cloud Operating System, implemented based on Kubernetes namespaces. It serves
as a multi-tenant resource isolation mechanism, allowing the partitioning of a Kubernetes cluster into multiple
workspaces. Each workspace has its own resource quotas and permissions, enabling the allocation of different users to
distinct workspaces for resource isolation and permission control.

Personal workspace is a special form of workspace. Each user has a personal workspace with a name identical to their
username. The resource quotas and permissions of personal workspaces are the same as regular workspaces. However,
personal workspaces cannot be deleted, and other users cannot be added to them.

### Roles and Permissions

Users within a workspace can have different roles, each with its own set of permissions. Currently, Sealos Cloud
Operating System includes the following roles: Owner, Manager, and Developer.

+ Owner: Possesses all permissions within the workspace, including deleting the workspace, viewing/creating/modifying
  all resources within the workspace, and inviting users to join the workspace as administrators/developers.
+ Manager: Possesses managerial permissions within the workspace, such as viewing/creating/modifying all resources
  within the workspace and inviting users to join as developers.
+ Developer: Possesses development permissions within the workspace, including viewing the status of resources within
  the workspace.

## Quick Start

### Create Workspace



### Switch Workspace



### Invite Users to Join Workspace

Invite users to join the workspace using their user ID. The invited users can choose to accept or decline the
invitation. If accepted, the invited users become members of the workspace with resource permissions.



### Accept Invitation

When a user is invited to join a workspace, they can view the invitation message in the management panel. By clicking on
the invitation message, they can see the details and accept the invitation. After acceptance, the user becomes a member
of the workspace with resource permissions.

---

### Archived 4.0 Docs Self Hosting Lifecycle Management QA (`docs/archived/4.0/docs/self-hosting/lifecycle-management/QA.md`)

---
sidebar_position: 1
---

# Frequently Asked Questions

When using Sealos, you may encounter some common questions and issues. Here are answers and solutions to some of the common problems.

## Image Building Issues

### Q1: How to set up a proxy service during the build phase?

During the execution of the build command, you can configure a proxy service by setting the HTTP_PROXY environment variable.

```shell
HTTP_PROXY=socket5://127.0.0.1:7890 sealos build xxxxx
```

### Q2: How to enable debug logs for buildah?

To view debug logs for buildah, you can set the `BUILDAH_LOG_LEVEL` environment variable.

```shell
BUILDAH_LOG_LEVEL=debug sealos images
```

### Q3: How to execute Sealos build within a Pod?

If you want to execute Sealos build within a Pod, follow these steps:

1. Build the image within the Pod. You can create a Deployment with the following YAML configuration:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sealoscli
  name: sealoscli
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sealoscli
  strategy: {}
  template:
    metadata:
      labels:
        app: sealoscli
    spec:
      containers:
        - image: # Replace with your sealos image
          name: sealoscli
          stdin: true
          stdinOnce: true
          securityContext:
            privileged: true
```

2. Create a Dockerfile. Here's an example that you can modify as per your needs:

```dockerfile
FROM bitnami/minideb:buster

ARG TARGETOS
ARG TARGETARCH

LABEL from=bitnami/minideb:buster platform=rootcloud team=oam tag=buster name=base

RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && sed -i "s@http://security.debian.org@http://mirrors.aliyun.com/debian-security@g" /etc/apt/sources.list
RUN install_packages curl iputils-ping net-tools telnet procps vim wget jq

ENV LANG=C.UTF-8
ENV LANGUAGE=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV TZ=Asia/Shanghai
```

3. Execute the build command within the Pod.

```shell
sealos build --arch arm64 --build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 -t test  -f Dockerfile .
```

### Q4: How to Build Cluster Images Using Other Build Tools?

If you want to use other container tools like Docker or Podman to build cluster images, you can utilize [sreg](https://github.com/labring/sreg) to cache the images.

Follow these steps:

1. Install sreg:
   ```shell
   wget https://github.com/labring/sreg/releases/download/v0.1.1/sreg_0.1.1_linux_amd64.tar.gz
   tar -xzf sreg_0.1.1_linux_amd64.tar.gz sreg
   mv sreg /usr/bin/
   ```
2. Cache the images:
   ```shell
   sreg save --registry-dir=registry .
   ```
3. Build the cluster image:
   ```shell
   docker build -t xxxx -f Sealfile .
   ```

### Q5: Encounter the error "lgetxattr /var/lib/containers/storage/overlay/0c2afe770ec7870ad4639f18a1b50b3a84718f95c8907f3d54e14dbf0a01d50d/merged/dev/ptmx: no such device" during Sealos build. How to fix it?

This issue might be related to the version of `fuse-overlayfs`. We recommend downloading the latest version from [here](https://github.com/containers/fuse-overlayfs/releases) and replacing `/bin/fuse-overlayfs`.

## Runtime Selection Issues

### Q1: How to select the Kubernetes runtime?

Sealos determines the runtime based on the image you choose. If you select the `kubernetes-docker` image, Sealos will use Docker as the runtime. If you choose the `kubernetes-crio` image, Sealos will use CRI-O as the runtime.

## Version Compatibility Issues

### Q1: Error "Applied to cluster error: failed to

init exec auth.sh failed exit status 127"?

This error is often caused by a mismatch between the version of Sealos and the version of the image being used. Make sure that the image version and the Sealos version are compatible. For example, if you are using a Kubernetes version like `v1.xx.x`, you may need to upgrade Sealos, especially if you are using an older version of Sealos while the Sealos cluster image is using the latest version. Another solution is to choose the corresponding version of the Sealos image. For example, if your Sealos version is 4.1.3, then the cluster image should be something like `kubernetes:v1.24.0-4.1.3`. Ensuring that the image version and Sealos version are compatible can help avoid such issues.

### Q2: Error when adding additional domains or modifying the service CIDR in the cluster during the addition of a master node

To address this issue, the Sealos team made the necessary fixes in version 4.2.0. You can refer to the specific fix and discussion in this pull request: [https://github.com/labring/sealos/pull/2943](https://github.com/labring/sealos/pull/2943).

Therefore, if you encounter this problem, we recommend upgrading to Sealos version 4.2.0. The updated version should handle these changes correctly and not produce errors when adding a master node.

## File and Directory Location Issues

### Q1: How to modify the default storage location for `/root/.sealos`?

If you need to change the default storage location, you can set the `SEALOS_RUNTIME_ROOT` environment variable and then run the Sealos command. It is recommended to set this environment variable globally so that it can be conveniently used in other commands or scenarios.

```shell
export SEALOS_RUNTIME_ROOT=/data/.sealos 
sealos run labring/kubernetes:v1.24.0
```

### Q2: How to modify the default storage location for `/var/lib/sealos`?

If you need to change the default storage location, you can set the `SEALOS_DATA_ROOT` environment variable and then run the Sealos command. Similarly, it is recommended to set this environment variable globally.

```shell
export SEALOS_DATA_ROOT=/data/sealos 
sealos run labring/kubernetes:v1.24.0
```

### Q3: How to modify the storage paths for Sealos image data and status?

> When using the Sealos cluster, you may need to change the default storage paths for image data and status data. By default, these data are stored at the locations defined in the `/etc/containers/storage.conf` file.

1. **View the current storage configuration**
   First, you can use the following command to view the current image storage configuration:
   ```
   sealos images --debug
   ```
   This command will print the file that contains the current storage configuration, for example:
   ```
   2023-06-07T16:27:02 debug using file /etc/containers/storage.conf as container storage config
   REPOSITORY   TAG   IMAGE ID   CREATED   SIZE
   ```
2. **Modify the storage path for image data**
   If you want to change the storage path for image data, you can edit the `/etc/containers/storage.conf` file. In this file, find and modify the `graphroot` field to set it to the new path. For example:
   ```
   vim /etc/containers/storage.conf
   ```
   In the editor, modify the value of the `graphroot` field to the desired new path.
3. **Modify the storage

path for status data**
Similar to the design of Buildah, Sealos also provides the ability to set the storage path for status data. In the same configuration file `/etc/containers/storage.conf`, find and modify the `runroot` field to the new path.

By following these steps, you can save the image data and status data of the Sealos cluster to the new paths you set. Each time you run a Sealos command, it will use the new paths you set in `graphroot` and `runroot` to store the image data and status data, respectively.

### Q4: How to disable file md5 check during SSH file transfer?

When the network environment is good, disabling the md5 check can greatly improve transfer speed. If you don't want to check the md5 of files during SSH file transfer, you can add the `-o "HashKnownHosts no"` option to the SSH command.

```shell
scp -o "HashKnownHosts no" local_file remote_user@remote_ip:/path/to/destination
```

This option tells SSH not to hash the hostnames in the known_hosts file, which avoids the md5 check during file transfer.

---

### Archived 4.0 Docs Self Hosting Lifecycle Management Lifecycle Management (`docs/archived/4.0/docs/self-hosting/lifecycle-management/lifecycle-management.md`)

---
sidebar_position: 0
---

# Kubernetes Lifecycle Management

Sealos provides a powerful set of tools that allow users to easily manage the entire lifecycle of a cluster.

## Features

With Sealos, you can install a bare Kubernetes cluster without any components. Additionally, Sealos can assemble various upper-layer distributed applications on top of Kubernetes using cluster image capabilities, such as databases, message queues, and more.

Sealos not only allows you to install a single-node Kubernetes development environment but also enables you to build production-grade highly available clusters with thousands of nodes.

Sealos offers features like cluster scaling, backup and recovery, and cluster release. It provides an excellent Kubernetes runtime experience even in offline environments.

## Key Features

- ARM support. Offline packages v1.20 and above support integration with both containerd and Docker.
- Provides 99-year certificates and supports cluster backup and upgrade.
- Does not rely on Ansible, HAProxy, or Keepalived. It is a standalone binary tool with zero dependencies.
- Provides offline installation. Different versions of Kubernetes only require different cluster images.
- High availability is achieved through localLB based on IPVS, which consumes fewer resources and provides stability and reliability, similar to kube-proxy implementation.
- Automatically recognizes image names using image-cri-shim, making offline delivery more convenient.
- Almost compatible with all x86_64 architectures that support systemd.
- Easy addition/deletion of cluster nodes.
- Trusted by tens of thousands of users in production environments, stable and reliable.
- Supports cluster images, allowing you to customize and combine the cluster components you need, such as OpenEBS storage + database + MinIO object storage.
- Uses the SDK of Buildah to standardize the image format, fully compatible with OCI standards.

## Running a Kubernetes Cluster with Sealos

Running a Kubernetes cluster with Sealos is straightforward. Just follow these steps:

```bash
$ curl -sfL  https://raw.githubusercontent.com/labring/sealos/v4.3.0/scripts/install.sh \
    | sh -s v4.3.0 labring/sealos
# Create a cluster
$ sealos run labring/kubernetes:v1.25.0-4.2.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
     --masters 192.168.64.2,192.168.64.22,192.168.64.20 \
     --nodes 192.168.64.21,192.168.64.19 -p [your-ssh-passwd]
```

[](https://asciinema.org/a/519263?speed=3)

## Running Distributed Applications on the Cluster

With the `sealos run` command, you can run various distributed applications on the cluster, such as databases, message queues, AI capabilities, and even enterprise-level SaaS software. For example:

```shell
# MySQL cluster
$ sealos run labring/mysql-operator:8.0.23-14.1

# Clickhouse cluster
$ sealos run labring/clickhouse:0.18.4

# Redis cluster
$ sealos run labring/redis-operator:3.1.4
```

## Customizing the Cluster

For cluster images not available in the Sealos ecosystem, users can easily build and customize their own cluster images. For example:

[Building an Ingress Cluster Image](/self-hosting/lifecycle-management/quick-start/build-ingress-cluster-image.md)

You can also customize your own Kubernetes cluster:

Sealfile:

```shell
FROM kubernetes:v1.25.0
COPY flannel-chart .
COPY mysql-chart .
CMD ["helm install flannel flannel-chart", "helm install mysql mysql-chart"]
```

```shell
sealos build -t my-kubernetes:v1.25.0 .
sealos run my-kubernetes:v1.25.0 ...
```

## Frequently Asked Questions

**Is Sealos a Kubernetes installation tool?**

Installation and deployment are basic functions of Sealos, similar to the boot module in a single-node operating system. Sealos' boot module effectively manages the lifecycle of Kubernetes in any scenario.

**What are the differences between Sealos, Rancher, and KubeSphere?**

Sealos is designed with the philosophy of "simplifying complexity, freely assembling, and simplicity as the ultimate goal." Sealos leverages the capabilities of Kubernetes to provide users with exactly what they need in a simple way. Users may not necessarily need Kubernetes; what they need is specific functionality.

Sealos is highly flexible and does not impose additional burdens on users. Its form depends on user requirements and the applications being installed. The core of Sealos is distributed applications, and all applications are treated equally.

---

### Archived 4.0 Docs Self Hosting Sealos QA (`docs/archived/4.0/docs/self-hosting/sealos/QA.md`)

---
sidebar_position: 3
---

# Q&A

Encountering issues during the deployment and use of Sealos Cloud is not uncommon. To assist you effectively, we have compiled a list of frequently encountered problems along with comprehensive solutions.

## Deployment Related Issues

This section details the problems you may face during the deployment phase and their respective solutions. For issues not covered here, please consult with us at the [Sealos Community](https://github.com/labring/sealos/discussions).

### Q1: iptables / ip_forward Concerns

**Problem Overview**: In some operating systems, such as older versions of Centos and RHEL, iptables or IPv4 IP forwarding is not enabled by default. This can hinder the creation of iptables rules or the forwarding of packets, potentially preventing the cluster from starting correctly.

**Resolution Strategy**: To address this, execute the following commands on each node to activate iptables and IP forwarding:

```shell
$ modprobe br_netfilter
$ echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
$ echo 1 > /proc/sys/net/ipv4/ip_forward
```

### Q2: Issues with System Kernel

- **Problem Overview**: An outdated system kernel can impede the proper startup of the cluster. Also, certain applications, especially those dependent on MongoDB 5.0, might not function with an older kernel.
- **Resolution Strategy**: Ensure your system's kernel version is at least 5.4 or higher before commencing the deployment.

### Q3: System Resource Constraints

- **Problem Overview**: Limited system resources can lead to deployment delays or even halts. If you encounter prolonged wait times, it's likely due to insufficient system resources.
- **Resolution Strategy**: Check the resource status of your nodes using `kubectl describe nodes`, focusing on CPU, memory, and storage availability.

### Q4: Networking Issues

- **Problem Overview**: Incorrect server configuration can lead to various network issues during deployment. Common areas of concern include:
   1. Misconfiguration of http_proxy / https_proxy environment variables;
   2. Inadequate server firewall settings;
   3. Improper server routing configurations;
- **Resolution Strategy**: Troubleshoot network issues by verifying the correctness of these configurations.

## Certificate and Domain Name Issues

### Certificate Renewal Process

Certificates are crucial for the security of your Sealos cluster. Follow these steps to update your certificates, especially as they approach their expiration date:

1. **Backup Existing Certificate**:

   On the `master0` node, backup your current certificate. This step is crucial to prevent loss of the certificate during the update process. Use this command:

   ```shell
   $ kubectl get secret -n sealos-system wildcard-cert -o yaml > cert-backup.yaml
   ```

   This will save the `wildcard-cert` certificate in YAML format to `cert-backup.yaml`.

2. **Storing the New Certificate**:

   Place your new certificate files (.crt and .key) on the `master0` node.

3. **Updating the Certificate**:

   To update, use the script below, replacing `<path-to-tls.crt>` and `<path-to-tls.key>` with the actual paths of your new certificate and key files.

   ```shell
   #!/bin/bash 
   # Set Variables
   CRT_FILE=<path-to-tls.crt>
   KEY_FILE=<path-to-tls.key>
   
   # Base64 encode the certificate and key files
   CRT_BASE64=$(cat $CRT_FILE | base64 -w 0)
   KEY_BASE64=$(cat $KEY_FILE | base64 -w 0)
   
   # Create JSON for update
   PATCH_JSON='{"data":{"tls.crt":"'$CRT_BASE64'","tls.key":"'$KEY_BASE64'"}}'
   
   # Update the Secret using kubectl patch
   kubectl patch secret wildcard-cert -n sealos-system -p $PATCH_JSON
   ```
   
   This script encodes the new certificate in Base64 and updates the Kubernetes cluster's Secret object using `kubectl patch`.

### Changing the Domain Name

Changing a domain name in a Sealos cluster is complex, often requiring adjustments in multiple components and services. We do not currently provide a comprehensive guide for this process in our documentation. However, future plans include the release of a Sealos Cluster Management Panel for easier domain name and certificate replacement.

It's important to note that domain name changes demand deep knowledge of the cluster's network setup and may involve intricate DNS settings and service discovery. We recommend undertaking such changes only if you have the requisite expertise or with guidance from a professional.

### user registration switch

disabled user register:

```shell
kubectl get cm -n sealos desktop-frontend-config -o yaml | sed 's/signUpEnabled: true/signUpEnabled: false/g' | kubectl apply -f -
kubectl rollout restart deployment desktop-frontend -n sealos
```

enabled user register:

```shell
kubectl get cm -n sealos desktop-frontend-config -o yaml | sed 's/signUpEnabled: false/signUpEnabled: true/g' | kubectl apply -f -
kubectl rollout restart deployment desktop-frontend -n sealos
```


## Database Issues

### Dify installation

The Sealos offline package does not include the vector database by default (and the related image is not packaged), so it is currently not possible to install the Dify application in a privately deployed Sealos cluster.

---

### Archived 4.0 Docs Self Hosting Sealos Install Object Storage (`docs/archived/4.0/docs/self-hosting/sealos/install-object-storage.md`)

---
sidebar_position: 2
---

# Install Object Storage

Download the Helm charts.

```bash
curl -O https://raw.githubusercontent.com/minio/operator/master/helm-releases/operator-5.0.6.tgz
```

Install Operator.

```bash
helm install --namespace minio-system --create-namespace minio-operator operator-5.0.6.tgz
```

Install Minio, Controller, etc.

```bash
# DOMAIN is the domain name for the Sealos cluster
# Set environment variables for Minio admin account (default Minio admin account is username/passw0rd)
# -e minioAdminUser={16-character random alphanumeric string} -e minioAdminPassword={32-character random alphanumeric string}
sealos run ghcr.io/labring/sealos-cloud-objectstorage:latest -e cloudDomain={DOMAIN}
```

# Uninstall Object Storage

Installation of the Object Storage failed, you can use the script to clean up the remaining resources. Uninstalling the
Object Storage can also be done using the script to clean up.

```bash
#!/usr/bin/env bash
set +e

kubectl delete app objectstorage -n app-system
kubectl delete ns objectstorage-system objectstorage-frontend
helm uninstall minio-operator -n minio-system
kubectl delete ns minio-system
kubectl delete crd objectstoragebuckets.objectstorage.sealos.io objectstorageusers.objectstorage.sealos.io
kubectl delete clusterrole objectstorage-manager-role objectstorage-metrics-reader objectstorage-proxy-role
kubectl delete clusterrolebinding objectstorage-manager-rolebinding objectstorage-proxy-rolebinding
```

---

### Archived 4.0 Docs Self Hosting Sealos Installation (`docs/archived/4.0/docs/self-hosting/sealos/installation.md`)

---
sidebar_position: 1
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Install Sealos Cluster

export const Highlight = ({children, color}) => (
  <span
    style={{
      backgroundColor: color,
      borderRadius: '2px',
      color: '#fff',
      padding: '0.2rem',
    }}>
    {children}
  </span>
);

:::tip

In the context of large-scale clusters and corporate production environments, [<Highlight color="#1877F2">the enterprise or bespoke editions of the Sealos private cloud</Highlight>](/self-hosting) come highly recommended.

:::

## Before You Begin

### Hardware

- Unique hostnames for each cluster node.
- Time synchronization across all nodes.
- Preferably use a fresh operating system for setting up the cluster. **Refrain from installing Docker yourself!**
- Compatible with numerous Linux versions like Ubuntu, Debian, CentOS, Rocky Linux.
- **Ensure a system kernel version of 5.4 or higher**.

Recommended System Configuration:

We advise using Ubuntu 22.04 LTS with a kernel version of 5.4 or higher. The specifications are as follows:

| Operating System | Kernel Version | CPU | Memory | Storage | Masters    | Nodes |
|------------------|----------------|-----|--------|---------|------------|-------|
| Ubuntu 22.04 LTS | ≥ 5.4          | 8C  | 16GB   | 100GB   | Odd Number | Any   |

:::info
Kubernetes and Sealos Cloud Operating system require roughly 2 cores (2c) and 2GB of memory (2g) per Master node, and about 1 core (1c) and 1GB of memory (1g) per Node node. Ensure each node in your cluster is well-equipped for these system components.
:::

### Network Considerations

- All nodes must be interconnected;
- Installation scripts should be run on the **first Master node** of the Kubernetes cluster; **nodes outside the cluster aren't set up for installations yet**;
- Make sure all nodes are capable of mutual communication.

### Domain Name Usage

- A domain name is necessary for accessing Sealos and its services;
- If you lack a domain name, `nip.io` offers a free domain name service.

### Certificate Requirements

Sealos uses certificates for secure communication. Without your certificates, [cert-manager](https://cert-manager.io/docs/) will be employed for auto-certification.

If you are providing your certificate, it should support the following domains (assuming your domain is cloud.example.io):

- `*.cloud.example.io`
- `cloud.example.io`

## Installation Steps

We offer a one-click installation script to streamline the deployment process. This script is capable of setting up a Sealos cluster from scratch or integrating it into an existing Kubernetes cluster (use with caution on pre-existing clusters).

:::info
This script is specifically designed for deploying Sealos clusters on "Kubernetes clusters installed via Sealos," and is not compatible with Kubernetes clusters set up in other ways.

For instructions on deploying Kubernetes clusters using Sealos, refer to: [Installing Kubernetes Clusters](/self-hosting/lifecycle-management/quick-start/deploy-kubernetes.md). This method is compatible with most Kubernetes versions available on [Docker Hub](https://hub.docker.com/r/labring/kubernetes/tags), except for version 1.28 and higher.
:::

If your system is new to Kubernetes, **we advise using this script to install both Kubernetes and the Sealos cluster simultaneously.**

There are different installation options based on your domain name needs:

### 1. No public domain, don't want custom domains

If you don't have a public domain or need custom domains, you can use the free `nip.io` wildcard DNS service. `nip.io` maps dynamic IP addresses to fixed subdomains, useful for local dev environments.

It works by taking any IP address as part of a `nip.io` subdomain, and resolving requests back to that IP. For example, if your intranet IP is `192.168.1.10`, you can use the domain `192.168.1.10.nip.io`. Requests to this domain will resolve to `192.168.1.10`, eliminating the need to modify local hosts or set up intranet DNS.

To use nip.io for Sealos, run the below on the first master node and enter prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh
```

When prompted for the Sealos Cloud domain name, use a format like `[ip].nip.io`, where [ip] is your Master node's IP.

After installation, the terminal will display the Sealos access domain and login credentials, as shown below:

```shell
Sealos cloud login info:
Cloud Version: latest
URL: https://10.214.210.102.nip.io
admin Username: admin
admin Password: sealos2023
```

### 2. Have public domain, want public access

If you have a public domain and want public Sealos access, you'll need a trusted public SSL/TLS certificate. You can use acme.sh to automatically issue certs, or get free certs from your domain provider or purchase commercial certificates.

Place the certificate files in a directory on the first master, like `/root/certs/`.

:::info

You'll also need to configure DNS records at your domain provider:

```
cloud.example.io A <Master Node Public IP>
*.cloud.example.io A <Master Node Public IP>
```

This maps your domain and subdomains to the first master's public IP.

:::

Then run below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain> \
--cert-path=<your_crt> \
--key-path=<your_key>
```

+ `<your_domain>` is your public domain
+ `<your_crt>` is the certificate file path (`.crt` or `.pem`) e.g. `/root/certs/example.crt`
+ `<your_key>` is the private key file path (`.key` or `.pem`) e.g. `/root/certs/example.key`

### 3. Have public domain, want internal access

If you have a public domain but only internal IPs, or only want internal Sealos access, you just need to configure DNS records resolving to the first master's internal IP:

```
cloud.example.io A <Master Node Internal IP>
*.cloud.example.io A <Master Node Internal IP>
```

Then run the below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain>
```

Where `<your_domain>` is your public domain.

The installer will use [cert-manager](https://cert-manager.io/docs/) to automatically sign certificates.

### 4. No public domain, want custom domain

If you don't have a public domain but need a custom domain, set up internal DNS resolving a custom domain to the first master's internal IP.

:::note

Assuming the first master internal IP is `192.168.1.10`, and your custom domain is `cloud.example.io`.

:::

You can use CoreDNS, Reference configuration:

```
(global_cache) {
  cache {
    # [5, 60]
    success 65536 3600 300
    # [1, 10]
    denial 8192 600 60
    prefetch 1 60m 10%
  }
}

.:53 {
  errors
  health
  ready

  import global_cache

  template IN A cloud.example.io {
    answer "{{ .Name }} 60 IN A 192.168.1.10"
    fallthrough
  }

  forward . 223.5.5.5

  log
  loop

  reload 6s
}
```

This resolves `cloud.example.io` and subdomains to the first master internal IP.

Then run below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain>
```

Where `<your_domain>` is your custom domain.

The installer uses [cert-manager](https://cert-manager.io/docs/) for certificates.

## Ensuring Browsers Trust Your Self-Signed Certificate

When using installation options 1, 3, or 4, as highlighted earlier, your browser won't automatically recognize and trust your certificate. This leads to a warning message when you try to enter Sealos Cloud:



Continuing to Sealos Cloud despite the warning results in issues like the App icons not appearing correctly, and Apps failing to launch.



To address this, you'll need to export the self-signed certificate and set up your system to trust it. Follow these steps to do so.

### Exporting Self-Signed Certificates

The process of exporting self-signed certificates differs slightly in various browsers. Here's a guide for exporting these certificates in some of the most commonly used browsers:

#### Chrome (includes browsers based on Chromium, like the updated Edge and Brave)

1. In the address bar, click the "Not Secure" warning on the left side.
2. Select "Certificate is invalid" to bring up a window with certificate information.
3. In this window, go to the "Details" tab.
4. Within "Details", find and click on the "Export" option.
5. Choose a file name and location for saving, then complete the exporting procedure.

#### Firefox

1. On the webpage, click on "Advanced".

   

2. Next, click "View Certificate".

   

3. On the certificate page, select "PEM (certificate)".

   

#### Safari

1. Select "Show Details" on the page.

   

2. Click on "View this Certificate".

   

3. You'll see a window displaying the certificate chain.

   

4. To export the certificate, drag the one highlighted in red to either your desktop or a specific folder.



### Trusting Self-Signed Certificates

#### macOS

To trust a self-signed certificate on macOS, use the following command:

```bash
# Assuming the certificate is stored at ~/Downloads/10.214.210.102.nip.io.cer
$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/10.214.210.102.nip.io.cer
```

You can also trust the certificate through these steps:

##### 1. Adding the Certificate to Keychain

1. Open **Keychain Access**, click on the "System" category under "System Keychains."
2. Navigate to the certificate's location in "Finder" and **double-click the certificate file** (usually `.cer`, `.crt`, or `.pem`).
3. Authenticate with your username and password to allow changes.
4. The certificate is now added to your keychain.

##### 2. Trusting the Certificate

1. In Keychain Access, locate and double-click the newly added self-signed certificate in the "System" category.
2. In the certificate window, expand the "Trust" section.
3. Change the setting next to "When using this certificate" from "Use System Defaults" to "Always Trust."
4. Close the window and authenticate if prompted to confirm the changes.
5. The certificate is now trusted.

:::info Note

Self-signed certificates, not issued by a third-party Certificate Authority (CA), won't be trusted by other devices. Manually perform these steps on each device within your company or organization that needs to trust the certificate.

:::

#### Windows

1. Right-click the root certificate file and select "Install Certificate."
2. Choose "Current User" or "Local Machine," then "Next."
3. Select "Place all certificates in the following store," click "Browse," choose "Trusted Root Certification Authorities," "OK," then "Next."
4. Click "Finish," "Yes," then "OK."



#### Linux

Linux distributions vary in updating the root certificate store and paths for private certificates. First, copy the self-signed CA certificate to the designated path, then run the command to update the root certificate store.

<Tabs>
  <TabItem value="Debian/Ubuntu/Gentoo">

  ```bash
  # Debian/Ubuntu/Gentoo
  $ sudo cp root_ca.crt /usr/local/share/ca-certificates/root_ca.crt
  $ sudo update-ca-certificates
  $ sudo rm /usr/local/share/ca-certificates/root_ca.crt
  $ sudo update-ca-certificates --fresh
  ```

  </TabItem>
  <TabItem value="CentOS/Fedora/RHEL">

  ```bash
  # CentOS/Fedora/RHEL
  $ yum install ca-certificates
  $ update-ca-trust force-enable
  $ cp root_ca.crt /etc/pki/ca-trust/source/anchors/
  $ update-ca-trust
  ```

  </TabItem>
  <TabItem value="Alpine">

  ```bash
  # Alpine
  $ apk update && apk add --no-cache ca-certificates
  $ cp root_ca.crt /usr/local/share/ca-certificates/
  $ update-ca-certificates
  ```

  </TabItem>
  <TabItem value="OpenSUSE/SLES">

  ```bash
  # OpenSUSE/SLES
  $ cp root_ca.crt /etc/pki/trust/anchors/
  $ update-ca-certificates
  ```

  </TabItem>
</Tabs>

---

### Archived 4.0 I18n Zh Hans Advanced Guide How To Deploy The Application To Desktop (`docs/archived/4.0/i18n/zh-Hans/advanced-guide/how-to-deploy-the-application-to-desktop.md`)

# 如何部署应用到 desktop

## 使用 Terminal 编写 app.yaml

### 关键信息

- type: iframe，标识为一个 web 应用
- spec name 为桌面显示的名称
- url 应用地址
- icon 是在 desktop 上显示的图标

```yaml
apiVersion: app.sealos.io/v1
kind: App
metadata:
  name: app-sample
spec:
  name: Image Hub Demo
  icon:
  type: iframe
  data:
    url: https://hub.sealos.io/
    desc:
  icon: https://cloud.sealos.io/logo.svg
  menuData:
  displayType: normal
```



### apply yaml

```
kubectl apply -f app.yaml
```



### 刷新浏览器，桌面即可看到 App

---

### Archived 4.0 I18n Zh Hans Msa Privacy Policy (`docs/archived/4.0/i18n/zh-Hans/msa/privacy-policy.md`)

---
sidebar_position: 2
---

# Sealos 云服务隐私政策

我们非常重视您的隐私保护，在您使用本服务时，我们将按照以下政策收集、使用、披露和保护您的个人信息。请您仔细阅读并充分理解本隐私政策。

**信息收集**

1. 在您注册或使用本服务时，我们可能收集您的姓名、电话号码、电子邮件地址、地址等个人信息。
2. 在您使用本服务过程中产生的信息，如操作日志、访问IP地址、设备型号等。
3. 我们可能会通过 Cookies 或其他技术收集和存储您访问本服务的相关信息，以便为您提供更好的用户体验。

**信息使用**

1. 我们会根据法律法规规定以及与用户之间的约定来处理用户的个人信息。
2. 我们可能会将收集到的信息用于改进服务质量、开发新产品或功能等目的。
3. 我们可能会将收集到的信息用于向您推送与本服务相关的通知或广告。

**信息披露**

1. 我们不会向任何第三方披露您的个人信息，除非：

   1. 您事先同意；

   2. 法律法规要求；

   3. 为维护我们或其他用户的合法权益。

2. 我们可能与关联公司、合作伙伴分享您的个人信息，但我们会采取相应的保密措施，确保信息安全。

**信息保护**

1. 我们采取各种安全措施，包括加密、访问控制等技术手段，以保护您的个人信息免受未经授权的访问、使用或泄露。
2. 我们会定期对收集、存储和处理的个人信息进行安全评估，以确保个人信息安全。
3. 在发生个人信息泄露等安全事件时，我们会立即启动应急预案，并在法律法规规定的范围内向您及时告知。

**用户权利**

1. 您有权随时查阅、更正或删除您的个人信息。
2. 您有权拒绝我们收集您的个人信息，但这可能导致您无法使用本服务的部分功能。
3. 您有权要求我们停止处理您的个人信息，但这可能导致您无法继续使用本服务。

**隐私政策更新**

1. 我们可能会对本隐私政策进行修改。如本隐私政策发生变更，我们将在本服务页面上发布修改后的隐私政策。如您继续使用本服务，则视为同意修改后的隐私政策。
2. 我们鼓励您定期查阅本隐私政策，以了解我们如何保护您的个人信息。

**未成年人保护**

我们非常重视对未成年人个人信息的保护，如您为未成年人，请在监护人指导下使用本服务，并请监护人帮助您在使用本服务过程中正确处理个人信息。

**跨境数据传输**

由于我们的服务器可能位于不同国家或地区，您同意我们可能需要将您的个人信息传输至其他国家或地区，并在该等国家或地区存储和处理以向您提供服务。我们会采取适当措施确保跨境传输的数据仍然受到适当保护。

**联系我们**

1. 如您对本隐私政策有任何疑问、建议或投诉，请通过以下方式与我们联系(微信)：
   [fangnux]
2. 我们将尽快回复并解决您提出的问题。

---

### Archived 4.0 I18n Zh Hans Msa Terms Of Service (`docs/archived/4.0/i18n/zh-Hans/msa/terms-of-service.md`)

---
sidebar_position: 1
---

# Sealos 云服务服务协议

Sealos 云服务服务协议是您与珠海环界云计算有限公司（以下简称“我们”或“本公司”）之间就云服务（以下简称“本服务”）的使用等相关事项所订立的协议。请您仔细阅读并充分理解本协议各条款，特别是免除或者限制我们责任的条款、对您权益的限制条款、争议解决和法律适用条款等。如您不同意本协议任一内容，请勿注册或使用本服务。

**第1条 服务内容**

1. 我们将向您提供存储、计算、网络传输等基于互联网的信息技术服务。
2. 我们将为您提供相关技术支持和客户服务，帮助您更好地使用本服务。
3. 您同意我们有权自行决定变更、中断、终止或暂停本服务的全部或部分功能，且无需对您承担任何责任。

**第2条 用户注册与账户管理**

1. 您在使用本服务前需要注册一个账户。您保证在注册时提供的信息真实、准确、完整，并及时更新。
2. 您应妥善保管账户名和密码，对由此产生的全部行为负责。如发现他人使用您的账户，应立即通知我们。
3. 我们有权对您的账户进行审查，如发现您的账户存在异常情况，我们有权暂停或终止向您提供服务。

**第3条 使用规则**

1. 您不得利用本服务从事任何违法活动或侵犯他人合法权益的行为，包括但不限于侵犯知识产权、泄露他人商业机密等。
2. 您不得通过任何手段恶意注册账户，包括但不限于以牟利、炒作、套现等目的。
3. 您不得利用本服务传播任何违法、有害、恶意软件等信息。
4. 您应遵守相关法律法规及本协议的规定，对在本服务中发布的信息及使用本服务所产生的结果承担全部责任。

**第4条 费用及支付**

1. 您同意支付与本服务相关的费用，具体费用标准以我们公布的价格为准。
2. 我们可能会根据市场情况调整费用标准，并提前通知您。您如继续使用本服务，则视为同意调整后的费用标准。
3. 如您未按时支付费用，我们有权暂停或终止向您提供本服务，并保留追讨欠款及要求赔偿的权利。

**第5条 服务免责与责任限制**

1. 本服务按照现有技术和条件所能达到的水平提供。我们不能保证本服务无故障、安全完全可靠或满足您的所有需求。
2. 如因不可抗力导致本服务发生故障或无法正常使用，我们不承担责任。
3. 对于因您自身原因导致的数据丢失、损坏等情况，我们不承担责任。

**第6条 隐私政策**

您同意接受并遵守我们制定的隐私政策。隐私政策为本协议的一部分，具体内容请参见下文“隐私政策”。

**第7条 知识产权**

1. 我们对本服务及相关软件、技术、文档等拥有全部知识产权，除非经我们明确许可，您不得进行复制、分发、出租、反向工程等行为。
2. 您在使用本服务过程中产生的数据和内容（包括但不限于文件、图片等）之知识产权归您所有，但为了向您提供服务，您同意授权我们在必要范围内对其进行存储、备份等操作。

**第8条 协议终止**

1. 如您违反本协议规定，我们有权立即终止向您提供服务，并保留追究法律责任的权利。
2. 如您决定停止使用本服务，可以申请注销账户，本协议自账户注销之日起终止。

**第9条 争议解决和法律适用**

1. 本协议的签订、履行、解释和争议解决均适用中华人民共和国法律。
2. 若您与我们发生争议，应先友好协商解决；协商不成的，任何一方均有权将争议提交至有管辖权的人民法院诉讼解决。

**第10条 网络安全**

1. 如果利用平台服务提供违反国家法律的服务，您需要自行承担后果。
2. 您对外提供的服务需要做好监管职责，如有用户在您的服务上从事违反国家法律的行为，您需自行承担后果。
3. 我们如果发现您存在违法行为，将会对相关部门发起诉讼，并为有关部门提供证据。

**第11条 其他条款**

1. 如本协议中部分条款因违反法律法规而被视为无效，不影响其他条款的效力。
2. 本公司保留对本协议及隐私政策的最终解释权。如您对本协议或隐私政策有任何疑问，请联系我们。

---

### Archived 4.0 I18n Zh Hans Quick Start Next Steps (`docs/archived/4.0/i18n/zh-Hans/quick-start/next-steps.md`)

---
sidebar_position: 5
---

# 下一步

恭喜您成功进入了 Sealos 的世界，现在您可以选择深入了解 Sealos 的更多功能：

---

### Archived 4.0 I18n Zh Hans Quick Start Use App Launchpad (`docs/archived/4.0/i18n/zh-Hans/quick-start/use-app-launchpad.md`)

---
sidebar_position: 2
---

# 使用应用管理

Sealos 的桌面环境类似于单机操作系统 macOS 或 Windows 的桌面环境，桌面上的每个图标都是一个 App，类似于 Windows 的快捷方式。与单机操作系统一样，Sealos 也有系统自带的 App，要想在这个云操作系统中快速安装应用，就需要用到系统自带的 App：**应用管理**。

> 关于应用管理的详细信息请参阅 [应用管理介绍](/guides/applaunchpad/applaunchpad.md)

下面将演示如何在 Sealos 云操作系统中快速安装一些比较常见的应用。

## 快速安装 Nginx

首先在 [Sealos](https://cloud.sealos.run) 桌面环境中打开**应用管理**。



点击「新建应用」。



依次输入应用名和镜像名，并开启外网访问，最后点击「部署应用」即可。



部署完成后点击「详情」进入应用详情界面。



可以看到 Nginx 应用的运行情况，包括 CPU 占用、内存占用等。点击外网地址即可通过外网域名直接打开 Nginx 界面。





## 快速安装 Nextcloud

再来看一个例子，在**应用管理**中快速安装开源的私人网盘应用 Nextcloud。

与之前的例子一样，在**应用管理**中点击「新建应用」。依次输入应用名和镜像名，选择合适的 CPU 和内存，并开启外网访问。



Nextcloud 容器的所有数据都存储在 `/var/www/html` 这个目录下，因此我们需要将该目录下的数据通过外挂存储进行持久化。

继续往下，展开「高级配置」，在「本地存储」中点击「新增存储卷」。



选择外挂存储的容量，并填入存储挂载到应用中的路径，然后点击「确认」。



最后再点击右上角的「部署应用」，应用就安装完成了。

点击「应用详情」进入 Nextcloud 应用的详情页面，确认应用处于 Running 状态，然后点击外网地址直接打开 Nextcloud 的 Web 界面。



设置用户名和密码之后点击「Install」开始安装。稍等片刻安装完成后直接刷新页面。



输入用户名密码即可登录成功。

---

### Archived 4.0 I18n Zh Hans Quick Start Use Database (`docs/archived/4.0/i18n/zh-Hans/quick-start/use-database.md`)

---
sidebar_position: 4
---

# 使用数据库

数据库是数据管理的重要手段 , 可用于高效地存储和访问数据。Sealos 提供了一个简单易用的数据库前端应用，屏蔽了繁琐的命令行操作，帮助你管理关系数据库、NoSQL、向量数据库和流数据库等各种类型的数据库。你只需通过「[数据库](/guides/dbprovider/dbprovider.md)」应用就能轻松创建各种数据库，包括 MySQL、PostgreSQL、MongoDB、Redis 等多种类型的数据库。

下面将通过示例来演示 Sealos 如何快速安装 MySQL。

## 快速安装 MySQL

1. 在 [Sealos](https://cloud.sealos.run) 桌面环境中打开数据库。



2. 点击新建数据库，完成基础配置设置。



3. 点击「部署」，然后点击「确认」等待数据库创建成功。



4. 点击一键连接，就可以直接打开「[终端](../../guides/terminal/terminal.md)」应用进入数据库的命令行终端。



## 快速安装 PostgreSQL 和 MongoDB

PostgreSQL 和 MongoDB 数据库的安装和 MySQL 类似，需要在基础配置界面选择相应的数据库类型。

---

### Archived 4.0 I18n Zh Hans Quick Start Use Template (`docs/archived/4.0/i18n/zh-Hans/quick-start/use-template.md`)

---
sidebar_position: 1
---

# 使用模板

这篇文档将会向您展示如何使用应用模板来快速安装各种分布式应用，并最大限度地发挥 Sealos 的功能。

## 1. 选择模板

首先在 [Sealos](https://cloud.sealos.run) 桌面环境中打开「模板市场」。



选择自己想要部署的应用模板。



不知道部署哪个应用？可以试试 [FastGPT AI 知识库](/examples/ai-applications/install-fastgpt-on-desktop.md)

## 2. 将模板应用部署到 Sealos

选择模板之后，设置好相应的参数值，点击「部署应用」按钮开始部署。



部署完成后，点击「确认」跳转到应用详情。



等待应用的状态变成 `running` 之后，点击外网地址即可通过外网域名直接打开应用的 Web 界面。

---

### Archived 5.0 Docs Developer Guide Lifecycle Management QA (`docs/archived/5.0/docs/developer-guide/lifecycle-management/QA.md`)

---
sidebar_position: 1
keywords: [Sealos, Kubernetes, image building, runtime selection, version compatibility, file storage, FAQ]
description: Comprehensive FAQ for Sealos users covering image building, runtime selection, version compatibility, and file storage issues. Includes solutions and best practices.
---

# Frequently Asked Questions

When using Sealos, you may encounter some common questions and issues. Here are answers and solutions to some of the
common problems.

## Image Building Issues

### Q1: How to set up a proxy service during the build phase?

During the execution of the build command, you can configure a proxy service by setting the HTTP_PROXY environment
variable.

```shell
HTTP_PROXY=socket5://127.0.0.1:7890 sealos build xxxxx
```

### Q2: How to enable debug logs for buildah?

To view debug logs for buildah, you can set the `BUILDAH_LOG_LEVEL` environment variable.

```shell
BUILDAH_LOG_LEVEL=debug sealos images
```

### Q3: How to execute Sealos build within a Pod?

If you want to execute Sealos build within a Pod, follow these steps:

1. Build the image within the Pod. You can create a Deployment with the following YAML configuration:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sealoscli
  name: sealoscli
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sealoscli
  strategy: {}
  template:
    metadata:
      labels:
        app: sealoscli
    spec:
      containers:
        - image: # Replace with your sealos image
          name: sealoscli
          stdin: true
          stdinOnce: true
          securityContext:
            privileged: true
```

2. Create a Dockerfile. Here's an example that you can modify as per your needs:

```dockerfile
FROM bitnami/minideb:buster

ARG TARGETOS
ARG TARGETARCH

LABEL from=bitnami/minideb:buster platform=rootcloud team=oam tag=buster name=base

RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && sed -i "s@http://security.debian.org@http://mirrors.aliyun.com/debian-security@g" /etc/apt/sources.list
RUN install_packages curl iputils-ping net-tools telnet procps vim wget jq

ENV LANG=C.UTF-8
ENV LANGUAGE=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV TZ=Asia/Shanghai
```

3. Execute the build command within the Pod.

```shell
sealos build --arch arm64 --build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 -t test  -f Dockerfile .
```

### Q4: How to Build Cluster Images Using Other Build Tools?

If you want to use other container tools like Docker or Podman to build cluster images, you can
utilize [sreg](https://github.com/labring/sreg) to cache the images.

Follow these steps:

1. Install sreg:
   ```shell
   wget https://github.com/labring/sreg/releases/download/v0.1.1/sreg_0.1.1_linux_amd64.tar.gz
   tar -xzf sreg_0.1.1_linux_amd64.tar.gz sreg
   mv sreg /usr/bin/
   ```
2. Cache the images:
   ```shell
   sreg save --registry-dir=registry .
   ```
3. Build the cluster image:
   ```shell
   docker build -t xxxx -f Sealfile .
   ```

### Q5: Encounter the error "lgetxattr /var/lib/containers/storage/overlay/0c2afe770ec7870ad4639f18a1b50b3a84718f95c8907f3d54e14dbf0a01d50d/merged/dev/ptmx: no such device" during Sealos build. How to fix it?

This issue might be related to the version of `fuse-overlayfs`. We recommend downloading the latest version
from [here](https://github.com/containers/fuse-overlayfs/releases) and replacing `/bin/fuse-overlayfs`.

## Runtime Selection Issues

### Q1: How to select the Kubernetes runtime?

Sealos determines the runtime based on the image you choose. If you select the `kubernetes-docker` image, Sealos will
use Docker as the runtime. If you choose the `kubernetes-crio` image, Sealos will use CRI-O as the runtime.

## Version Compatibility Issues

### Q1: Error "Applied to cluster error: failed to

init exec auth.sh failed exit status 127"?

This error is often caused by a mismatch between the version of Sealos and the version of the image being used. Make
sure that the image version and the Sealos version are compatible. For example, if you are using a Kubernetes version
like `v1.xx.x`, you may need to upgrade Sealos, especially if you are using an older version of Sealos while the Sealos
cluster image is using the latest version. Another solution is to choose the corresponding version of the Sealos image.
For example, if your Sealos version is 4.1.3, then the cluster image should be something like
`kubernetes:v1.24.0-4.1.3`. Ensuring that the image version and Sealos version are compatible can help avoid such
issues.

### Q2: Error when adding additional domains or modifying the service CIDR in the cluster during the addition of a master node

To address this issue, the Sealos team made the necessary fixes in version 4.2.0. You can refer to the specific fix and
discussion in this pull
request: [https://github.com/labring/sealos/pull/2943](https://github.com/labring/sealos/pull/2943).

Therefore, if you encounter this problem, we recommend upgrading to Sealos version 4.2.0. The updated version should
handle these changes correctly and not produce errors when adding a master node.

## File and Directory Location Issues

### Q1: How to modify the default storage location for `/root/.sealos`?

If you need to change the default storage location, you can set the `SEALOS_RUNTIME_ROOT` environment variable and then
run the Sealos command. It is recommended to set this environment variable globally so that it can be conveniently used
in other commands or scenarios.

```shell
export SEALOS_RUNTIME_ROOT=/data/.sealos 
sealos run labring/kubernetes:v1.24.0
```

### Q2: How to modify the default storage location for `/var/lib/sealos`?

If you need to change the default storage location, you can set the `SEALOS_DATA_ROOT` environment variable and then run
the Sealos command. Similarly, it is recommended to set this environment variable globally.

```shell
export SEALOS_DATA_ROOT=/data/sealos 
sealos run labring/kubernetes:v1.24.0
```

### Q3: How to modify the storage paths for Sealos image data and status?

> When using the Sealos cluster, you may need to change the default storage paths for image data and status data. By
> default, these data are stored at the locations defined in the `/etc/containers/storage.conf` file.

1. **View the current storage configuration**
   First, you can use the following command to view the current image storage configuration:
   ```
   sealos images --debug
   ```
   This command will print the file that contains the current storage configuration, for example:
   ```
   2023-06-07T16:27:02 debug using file /etc/containers/storage.conf as container storage config
   REPOSITORY   TAG   IMAGE ID   CREATED   SIZE
   ```
2. **Modify the storage path for image data**
   If you want to change the storage path for image data, you can edit the `/etc/containers/storage.conf` file. In this
   file, find and modify the `graphroot` field to set it to the new path. For example:
   ```
   vim /etc/containers/storage.conf
   ```
   In the editor, modify the value of the `graphroot` field to the desired new path.
3. **Modify the storage

path for status data**
Similar to the design of Buildah, Sealos also provides the ability to set the storage path for status data. In the same
configuration file `/etc/containers/storage.conf`, find and modify the `runroot` field to the new path.

By following these steps, you can save the image data and status data of the Sealos cluster to the new paths you set.
Each time you run a Sealos command, it will use the new paths you set in `graphroot` and `runroot` to store the image
data and status data, respectively.

### Q4: How to disable file md5 check during SSH file transfer?

When the network environment is good, disabling the md5 check can greatly improve transfer speed. If you don't want to
check the md5 of files during SSH file transfer, you can add the `-o "HashKnownHosts no"` option to the SSH command.

```shell
scp -o "HashKnownHosts no" local_file remote_user@remote_ip:/path/to/destination
```

This option tells SSH not to hash the hostnames in the known_hosts file, which avoids the md5 check during file
transfer.

---

### Archived 5.0 Docs Developer Guide Lifecycle Management Lifecycle Management (`docs/archived/5.0/docs/developer-guide/lifecycle-management/lifecycle-management.md`)

---
sidebar_position: 0
keywords: [Sealos, cloud operating system, Kubernetes clusters, cloud-native applications, cluster management, container management, image management, cluster images, Sealos user guide, Rootfs cluster images]
description: Explore Sealos, a unified cloud OS for managing Kubernetes clusters and cloud-native apps. Learn about cluster management, containers, and images with our comprehensive user guide.
---

# Kubernetes Lifecycle Management

Sealos provides a powerful set of tools that allow users to easily manage the entire lifecycle of a cluster.

## Features

With Sealos, you can install a bare Kubernetes cluster without any components. Additionally, Sealos can assemble various
upper-layer distributed applications on top of Kubernetes using cluster image capabilities, such as databases, message
queues, and more.

Sealos not only allows you to install a single-node Kubernetes development environment but also enables you to build
production-grade highly available clusters with thousands of nodes.

Sealos offers features like cluster scaling, backup and recovery, and cluster release. It provides an excellent
Kubernetes runtime experience even in offline environments.

## Key Features

- ARM support. Offline packages v1.20 and above support integration with both containerd and Docker.
- Provides 99-year certificates and supports cluster backup and upgrade.
- Does not rely on Ansible, HAProxy, or Keepalived. It is a standalone binary tool with zero dependencies.
- Provides offline installation. Different versions of Kubernetes only require different cluster images.
- High availability is achieved through localLB based on IPVS, which consumes fewer resources and provides stability and
  reliability, similar to kube-proxy implementation.
- Automatically recognizes image names using image-cri-shim, making offline delivery more convenient.
- Almost compatible with all x86_64 architectures that support systemd.
- Easy addition/deletion of cluster nodes.
- Trusted by tens of thousands of users in production environments, stable and reliable.
- Supports cluster images, allowing you to customize and combine the cluster components you need, such as OpenEBS
  storage + database + MinIO object storage.
- Uses the SDK of Buildah to standardize the image format, fully compatible with OCI standards.

## Running a Kubernetes Cluster with Sealos

Running a Kubernetes cluster with Sealos is straightforward. Just follow these steps:

```bash
$ curl -sfL  https://raw.githubusercontent.com/labring/sealos/v4.3.0/scripts/install.sh \
    | sh -s v4.3.0 labring/sealos
# Create a cluster
$ sealos run labring/kubernetes:v1.25.0-4.2.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
     --masters 192.168.64.2,192.168.64.22,192.168.64.20 \
     --nodes 192.168.64.21,192.168.64.19 -p [your-ssh-passwd]
```

[](https://asciinema.org/a/519263?speed=3)

## Running Distributed Applications on the Cluster

With the `sealos run` command, you can run various distributed applications on the cluster, such as databases, message
queues, AI capabilities, and even enterprise-level SaaS software. For example:

```shell
# MySQL cluster
$ sealos run labring/mysql-operator:8.0.23-14.1

# Clickhouse cluster
$ sealos run labring/clickhouse:0.18.4

# Redis cluster
$ sealos run labring/redis-operator:3.1.4
```

## Customizing the Cluster

For cluster images not available in the Sealos ecosystem, users can easily build and customize their own cluster images.
For example:

[Building an Ingress Cluster Image](/developer-guide/lifecycle-management/quick-start/build-ingress-cluster-image.md)

You can also customize your own Kubernetes cluster:

Sealfile:

```shell
FROM kubernetes:v1.25.0
COPY flannel-chart .
COPY mysql-chart .
CMD ["helm install flannel flannel-chart", "helm install mysql mysql-chart"]
```

```shell
sealos build -t my-kubernetes:v1.25.0 .
sealos run my-kubernetes:v1.25.0 ...
```

## Frequently Asked Questions

**Is Sealos a Kubernetes installation tool?**

Installation and deployment are basic functions of Sealos, similar to the boot module in a single-node operating system.
Sealos' boot module effectively manages the lifecycle of Kubernetes in any scenario.

**What are the differences between Sealos, Rancher, and KubeSphere?**

Sealos is designed with the philosophy of "simplifying complexity, freely assembling, and simplicity as the ultimate
goal." Sealos leverages the capabilities of Kubernetes to provide users with exactly what they need in a simple way.
Users may not necessarily need Kubernetes; what they need is specific functionality.

Sealos is highly flexible and does not impose additional burdens on users. Its form depends on user requirements and the
applications being installed. The core of Sealos is distributed applications, and all applications are treated equally.

---

### Archived 5.0 Docs Developer Guide Sealos QA (`docs/archived/5.0/docs/developer-guide/sealos/QA.md`)

---
sidebar_position: 3
keywords: [Sealos Cloud, deployment issues, certificate renewal, domain name change, user registration, kubernetes cluster, iptables, system kernel, networking, resource constraints]
description: Comprehensive guide for Sealos Cloud deployment issues, certificate management, and user registration. Includes solutions for common problems and step-by-step instructions for system administrators.
---

# Q&A

Encountering issues during the deployment and use of Sealos Cloud is not uncommon. To assist you effectively, we have
compiled a list of frequently encountered problems along with comprehensive solutions.

## Deployment Related Issues

This section details the problems you may face during the deployment phase and their respective solutions. For issues
not covered here, please consult with us at the [Sealos Community](https://github.com/labring/sealos/discussions).

### Q1: iptables / ip_forward Concerns

**Problem Overview**: In some operating systems, such as older versions of Centos and RHEL, iptables or IPv4 IP
forwarding is not enabled by default. This can hinder the creation of iptables rules or the forwarding of packets,
potentially preventing the cluster from starting correctly.

**Resolution Strategy**: To address this, execute the following commands on each node to activate iptables and IP
forwarding:

```shell
$ modprobe br_netfilter
$ echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
$ echo 1 > /proc/sys/net/ipv4/ip_forward
```

### Q2: Issues with System Kernel

- **Problem Overview**: An outdated system kernel can impede the proper startup of the cluster. Also, certain
  applications, especially those dependent on MongoDB 5.0, might not function with an older kernel.
- **Resolution Strategy**: Ensure your system's kernel version is at least 5.4 or higher before commencing the
  deployment.

### Q3: System Resource Constraints

- **Problem Overview**: Limited system resources can lead to deployment delays or even halts. If you encounter prolonged
  wait times, it's likely due to insufficient system resources.
- **Resolution Strategy**: Check the resource status of your nodes using `kubectl describe nodes`, focusing on CPU,
  memory, and storage availability.

### Q4: Networking Issues

- **Problem Overview**: Incorrect server configuration can lead to various network issues during deployment. Common
  areas of concern include:
    1. Misconfiguration of http_proxy / https_proxy environment variables;
    2. Inadequate server firewall settings;
    3. Improper server routing configurations;
- **Resolution Strategy**: Troubleshoot network issues by verifying the correctness of these configurations.

## Certificate and Domain Name Issues

### Certificate Renewal Process

Certificates are crucial for the security of your Sealos cluster. Follow these steps to update your certificates,
especially as they approach their expiration date:

1. **Backup Existing Certificate**:

   On the `master0` node, backup your current certificate. This step is crucial to prevent loss of the certificate
   during the update process. Use this command:

   ```shell
   $ kubectl get secret -n sealos-system wildcard-cert -o yaml > cert-backup.yaml
   ```

   This will save the `wildcard-cert` certificate in YAML format to `cert-backup.yaml`.

2. **Storing the New Certificate**:

   Place your new certificate files (.crt and .key) on the `master0` node.

3. **Updating the Certificate**:

   To update, use the script below, replacing `<path-to-tls.crt>` and `<path-to-tls.key>` with the actual paths of your
   new certificate and key files.

   ```shell
   #!/bin/bash 
   # Set Variables
   CRT_FILE=<path-to-tls.crt>
   KEY_FILE=<path-to-tls.key>
   
   # Base64 encode the certificate and key files
   CRT_BASE64=$(cat $CRT_FILE | base64 -w 0)
   KEY_BASE64=$(cat $KEY_FILE | base64 -w 0)
   
   # Create JSON for update
   PATCH_JSON='{"data":{"tls.crt":"'$CRT_BASE64'","tls.key":"'$KEY_BASE64'"}}'
   
   # Update the Secret using kubectl patch
   kubectl patch secret wildcard-cert -n sealos-system -p $PATCH_JSON
   ```

   This script encodes the new certificate in Base64 and updates the Kubernetes cluster's Secret object using
   `kubectl patch`.

### Changing the Domain Name

Changing a domain name in a Sealos cluster is complex, often requiring adjustments in multiple components and services.
We do not currently provide a comprehensive guide for this process in our documentation. However, future plans include
the release of a Sealos Cluster Management Panel for easier domain name and certificate replacement.

It's important to note that domain name changes demand deep knowledge of the cluster's network setup and may involve
intricate DNS settings and service discovery. We recommend undertaking such changes only if you have the requisite
expertise or with guidance from a professional.

### user registration switch

disabled user register:

```shell
kubectl get cm -n sealos desktop-frontend-config -o yaml | sed 's/signUpEnabled: true/signUpEnabled: false/g' | kubectl apply -f -
kubectl rollout restart deployment desktop-frontend -n sealos
```

enabled user register:

```shell
kubectl get cm -n sealos desktop-frontend-config -o yaml | sed 's/signUpEnabled: false/signUpEnabled: true/g' | kubectl apply -f -
kubectl rollout restart deployment desktop-frontend -n sealos
```

---

### Archived 5.0 Docs Developer Guide Sealos Installation (`docs/archived/5.0/docs/developer-guide/sealos/installation.md`)

---
sidebar_position: 1
keywords: [sealos cluster, kubernetes installation, self-signed certificates, domain configuration, cloud deployment, nip.io, cert-manager, cluster setup, network considerations, hardware requirements]
description: Learn how to install and configure a Sealos cluster with Kubernetes, including domain setup, certificate management, and network considerations for optimal deployment.
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Install Sealos Cluster

export const Highlight = ({children, color}) => (
  <span
    style={{
      backgroundColor: color,
      borderRadius: '2px',
      color: '#fff',
      padding: '0.2rem',
    }}>
    {children}
  </span>
);

:::tip

In the context of large-scale clusters and corporate production
environments, [<Highlight color="#1877F2">the enterprise or bespoke editions of the Sealos private cloud</Highlight>](/self-hosting)
come highly recommended.

:::

## Before You Begin

### Hardware

- Unique hostnames for each cluster node.
- Time synchronization across all nodes.
- Preferably use a fresh operating system for setting up the cluster. **Refrain from installing Docker yourself!**
- Compatible with numerous Linux versions like Ubuntu, Debian, CentOS, Rocky Linux.
- **Ensure a system kernel version of 5.4 or higher**.

Recommended System Configuration:

We advise using Ubuntu 22.04 LTS with a kernel version of 5.4 or higher. The specifications are as follows:

| Operating System | Kernel Version | CPU | Memory | Storage | Masters    | Nodes |
|------------------|----------------|-----|--------|---------|------------|-------|
| Ubuntu 22.04 LTS | ≥ 5.4          | 8C  | 16GB   | 100GB   | Odd Number | Any   |

:::info
Kubernetes and Sealos Cloud Operating system require roughly 2 cores (2c) and 2GB of memory (2g) per Master node, and
about 1 core (1c) and 1GB of memory (1g) per Node node. Ensure each node in your cluster is well-equipped for these
system components.
:::

### Network Considerations

- All nodes must be interconnected;
- Installation scripts should be run on the **first Master node** of the Kubernetes cluster; **nodes outside the cluster
  aren't set up for installations yet**;
- Make sure all nodes are capable of mutual communication.

### Domain Name Usage

- A domain name is necessary for accessing Sealos and its services;
- If you lack a domain name, `nip.io` offers a free domain name service.

### Certificate Requirements

Sealos uses certificates for secure communication. Without your
certificates, [cert-manager](https://cert-manager.io/docs/) will be employed for auto-certification.

If you are providing your certificate, it should support the following domains (assuming your domain is
cloud.example.io):

- `*.cloud.example.io`
- `cloud.example.io`

## Installation Steps

We offer a one-click installation script to streamline the deployment process. This script is capable of setting up a
Sealos cluster from scratch or integrating it into an existing Kubernetes cluster (use with caution on pre-existing
clusters).

:::info
This script is specifically designed for deploying Sealos clusters on "Kubernetes clusters installed via Sealos," and is
not compatible with Kubernetes clusters set up in other ways.

For instructions on deploying Kubernetes clusters using Sealos, refer
to: [Installing Kubernetes Clusters](/developer-guide/lifecycle-management/quick-start/deploy-kubernetes.md). This method
is compatible with most Kubernetes versions available on [Docker Hub](https://hub.docker.com/r/labring/kubernetes/tags),
except for version 1.28 and higher.
:::

If your system is new to Kubernetes, **we advise using this script to install both Kubernetes and the Sealos cluster
simultaneously.**

There are different installation options based on your domain name needs:

### 1. No public domain, don't want custom domains

If you don't have a public domain or need custom domains, you can use the free `nip.io` wildcard DNS service. `nip.io`
maps dynamic IP addresses to fixed subdomains, useful for local dev environments.

It works by taking any IP address as part of a `nip.io` subdomain, and resolving requests back to that IP. For example,
if your intranet IP is `192.168.1.10`, you can use the domain `192.168.1.10.nip.io`. Requests to this domain will
resolve to `192.168.1.10`, eliminating the need to modify local hosts or set up intranet DNS.

To use nip.io for Sealos, run the below on the first master node and enter prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh
```

When prompted for the Sealos Cloud domain name, use a format like `[ip].nip.io`, where [ip] is your Master node's IP.

After installation, the terminal will display the Sealos access domain and login credentials, as shown below:

```shell
Sealos cloud login info:
Cloud Version: latest
URL: https://10.214.210.102.nip.io
admin Username: admin
admin Password: sealos2023
```

### 2. Have public domain, want public access

If you have a public domain and want public Sealos access, you'll need a trusted public SSL/TLS certificate. You can use
acme.sh to automatically issue certs, or get free certs from your domain provider or purchase commercial certificates.

Place the certificate files in a directory on the first master, like `/root/certs/`.

:::info

You'll also need to configure DNS records at your domain provider:

```
cloud.example.io A <Master Node Public IP>
*.cloud.example.io A <Master Node Public IP>
```

This maps your domain and subdomains to the first master's public IP.

:::

Then run below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain> \
--cert-path=<your_crt> \
--key-path=<your_key>
```

+ `<your_domain>` is your public domain
+ `<your_crt>` is the certificate file path (`.crt` or `.pem`) e.g. `/root/certs/example.crt`
+ `<your_key>` is the private key file path (`.key` or `.pem`) e.g. `/root/certs/example.key`

### 3. Have public domain, want internal access

If you have a public domain but only internal IPs, or only want internal Sealos access, you just need to configure DNS
records resolving to the first master's internal IP:

```
cloud.example.io A <Master Node Internal IP>
*.cloud.example.io A <Master Node Internal IP>
```

Then run the below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain>
```

Where `<your_domain>` is your public domain.

The installer will use [cert-manager](https://cert-manager.io/docs/) to automatically sign certificates.

### 4. No public domain, want custom domain

If you don't have a public domain but need a custom domain, set up internal DNS resolving a custom domain to the first
master's internal IP.

:::note

Assuming the first master internal IP is `192.168.1.10`, and your custom domain is `cloud.example.io`.

:::

You can use CoreDNS, Reference configuration:

```
(global_cache) {
  cache {
    # [5, 60]
    success 65536 3600 300
    # [1, 10]
    denial 8192 600 60
    prefetch 1 60m 10%
  }
}

.:53 {
  errors
  health
  ready

  import global_cache

  template IN A cloud.example.io {
    answer "{{ .Name }} 60 IN A 192.168.1.10"
    fallthrough
  }

  forward . 223.5.5.5

  log
  loop

  reload 6s
}
```

This resolves `cloud.example.io` and subdomains to the first master internal IP.

Then run below on the first master, entering prompts:

```bash
$ curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.1/scripts/cloud/install.sh -o /tmp/install.sh && SEALOS_VERSION=v5.0.1 && bash /tmp/install.sh \
--cloud-domain=<your_domain>
```

Where `<your_domain>` is your custom domain.

The installer uses [cert-manager](https://cert-manager.io/docs/) for certificates.

## Ensuring Browsers Trust Your Self-Signed Certificate

When using installation options 1, 3, or 4, as highlighted earlier, your browser won't automatically recognize and trust
your certificate. This leads to a warning message when you try to enter Sealos Cloud:



Continuing to Sealos Cloud despite the warning results in issues like the App icons not appearing correctly, and Apps
failing to launch.



To address this, you'll need to export the self-signed certificate and set up your system to trust it. Follow these
steps to do so.

### Exporting Self-Signed Certificates

The process of exporting self-signed certificates differs slightly in various browsers. Here's a guide for exporting
these certificates in some of the most commonly used browsers:

#### Chrome (includes browsers based on Chromium, like the updated Edge and Brave)

1. In the address bar, click the "Not Secure" warning on the left side.
2. Select "Certificate is invalid" to bring up a window with certificate information.
3. In this window, go to the "Details" tab.
4. Within "Details", find and click on the "Export" option.
5. Choose a file name and location for saving, then complete the exporting procedure.

#### Firefox

1. On the webpage, click on "Advanced".

   

2. Next, click "View Certificate".

   

3. On the certificate page, select "PEM (certificate)".

   

#### Safari

1. Select "Show Details" on the page.

   

2. Click on "View this Certificate".

   

3. You'll see a window displaying the certificate chain.

   

4. To export the certificate, drag the one highlighted in red to either your desktop or a specific folder.

### Trusting Self-Signed Certificates

#### macOS

To trust a self-signed certificate on macOS, use the following command:

```bash
# Assuming the certificate is stored at ~/Downloads/10.214.210.102.nip.io.cer
$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/10.214.210.102.nip.io.cer
```

You can also trust the certificate through these steps:

##### 1. Adding the Certificate to Keychain

1. Open **Keychain Access**, click on the "System" category under "System Keychains."
2. Navigate to the certificate's location in "Finder" and **double-click the certificate file** (usually `.cer`, `.crt`,
   or `.pem`).
3. Authenticate with your username and password to allow changes.
4. The certificate is now added to your keychain.

##### 2. Trusting the Certificate

1. In Keychain Access, locate and double-click the newly added self-signed certificate in the "System" category.
2. In the certificate window, expand the "Trust" section.
3. Change the setting next to "When using this certificate" from "Use System Defaults" to "Always Trust."
4. Close the window and authenticate if prompted to confirm the changes.
5. The certificate is now trusted.

:::info Note

Self-signed certificates, not issued by a third-party Certificate Authority (CA), won't be trusted by other devices.
Manually perform these steps on each device within your company or organization that needs to trust the certificate.

:::

#### Windows

1. Right-click the root certificate file and select "Install Certificate."
2. Choose "Current User" or "Local Machine," then "Next."
3. Select "Place all certificates in the following store," click "Browse," choose "Trusted Root Certification
   Authorities," "OK," then "Next."
4. Click "Finish," "Yes," then "OK."



#### Linux

Linux distributions vary in updating the root certificate store and paths for private certificates. First, copy the
self-signed CA certificate to the designated path, then run the command to update the root certificate store.

<Tabs>
  <TabItem value="Debian/Ubuntu/Gentoo">

  ```bash
  # Debian/Ubuntu/Gentoo
  $ sudo cp root_ca.crt /usr/local/share/ca-certificates/root_ca.crt
  $ sudo update-ca-certificates
  $ sudo rm /usr/local/share/ca-certificates/root_ca.crt
  $ sudo update-ca-certificates --fresh
  ```

  </TabItem>
  <TabItem value="CentOS/Fedora/RHEL">

  ```bash
  # CentOS/Fedora/RHEL
  $ yum install ca-certificates
  $ update-ca-trust force-enable
  $ cp root_ca.crt /etc/pki/ca-trust/source/anchors/
  $ update-ca-trust
  ```

  </TabItem>
  <TabItem value="Alpine">

  ```bash
  # Alpine
  $ apk update && apk add --no-cache ca-certificates
  $ cp root_ca.crt /usr/local/share/ca-certificates/
  $ update-ca-certificates
  ```

  </TabItem>
  <TabItem value="OpenSUSE/SLES">

  ```bash
  # OpenSUSE/SLES
  $ cp root_ca.crt /etc/pki/trust/anchors/
  $ update-ca-certificates
  ```

  </TabItem>
</Tabs>

---

### Archived 5.0 Docs Developer Guide System Design Billing System (`docs/archived/5.0/docs/developer-guide/system-design/billing-system.md`)

---
keywords: [billing system, Sealos, cloud platform, usage tracking, payment processing, subscription management, cost optimization, cloud billing, enterprise billing, scalable billing]
description: Explore Sealos' robust billing system for cloud platforms. Learn about usage tracking, payment processing, and subscription management for optimized cloud costs.
---

# Billing System

---

### Archived 5.0 Docs Developer Guide System Design Monitor System (`docs/archived/5.0/docs/developer-guide/system-design/monitor-system.md`)

---
keywords: [monitor system, Sealos, Kubernetes monitoring, system performance, observability, metrics collection, log analysis, alerting, dashboard visualization, cloud-native monitoring]
description: Explore Sealos' robust monitor system for Kubernetes clusters. Learn about performance tracking, log analysis, and alerting features for optimal cloud-native observability.
---

# Monitor System

---

### Archived 5.0 Docs Developer Guide System Design System Application (`docs/archived/5.0/docs/developer-guide/system-design/system-application.md`)

---
keywords: [system application, Sealos, containerization, cloud-native, Kubernetes, application management, scalability, microservices, DevOps, cloud computing]
description: Explore Sealos system applications for efficient cloud-native containerization. Learn how to optimize application management and scalability in Kubernetes environments.
---

# System Application

---

### Archived 5.0 Docs Developer Guide System Design System Architecture (`docs/archived/5.0/docs/developer-guide/system-design/system-architecture.md`)

---
keywords: [system architecture, Sealos, cloud native, distributed systems, microservices, scalability, containerization, Kubernetes, infrastructure design, DevOps]
description: Explore Sealos' system architecture for cloud-native environments. Learn about distributed systems, microservices, and scalable infrastructure design for modern applications.
---

# System Architecture

---

### Archived 5.0 Docs Developer Guide System Design User System (`docs/archived/5.0/docs/developer-guide/system-design/user-system.md`)

---
keywords: [user system, Sealos, authentication, authorization, identity management, access control, user roles, permissions, security, cloud native]
description: Explore Sealos' user system for robust authentication, authorization, and identity management in cloud-native environments. Learn about access control and security features.
---

# User System

---

### Archived 5.0 Docs User Guide Ai Proxy Ai Proxy (`docs/archived/5.0/docs/user-guide/ai-proxy/ai-proxy.md`)

---
title: AI Proxy - 一站式 AI 模型调用解决方案 | Sealos
description: AI Proxy 是 Sealos 平台提供的统一 AI 模型调用服务，支持多平台 API Key 管理、统一计费和监控，让开发者轻松接入各类 AI 模型。
keywords: ["AI Proxy", "Sealos", "AI模型调用", "API管理", "统一计费", "开发者工具"]
---

# AI Proxy 使用指南

## 简介

AI Proxy 是 [Sealos 平台](/docs/5.0/introduction/what-is-sealos.md)提供的一站式 AI 模型调用解决方案，让开发者能够在统一的平台中轻松调用和管理各类 AI 模型。无论是通义千问、文心一言还是其他 AI 模型，都可以通过统一的接口进行调用。

### 为什么选择 AI Proxy？

- 🔑 **一键获取多平台密钥** - 无需分别注册各个 AI 平台
- 💰 **统一计费更省心** - 告别多平台充值的烦恼
- 📊 **集中管理更高效** - 一站式监控所有调用情况

## 功能特点

### 统一的 API 访问

- 提供标准化的 API 接口，支持多家主流 AI 模型厂商
- 兼容 OpenAI API 格式，便于快速迁移和集成
- 持续扩充支持的模型类型

### 简化的密钥管理



- 一键获取多平台 API Key
- 无需分别注册各个 AI 平台
- 统一的密钥管理界面

### 集中化计费与监控



- 使用 Sealos 平台统一结算
- 透明的按量计费模式
- 详细的费用明细和账单查询
- 详细的调用日志记录

## 快速开始

### 1. 获取 API Key

1. 访问 [Sealos Cloud](https://hzh.sealos.run)
2. 打开 AI Proxy 应用
3. 点击【新建】按钮创建新的 API Key
4. 复制生成的 API Endpoint 和 API Key

### 2. API 调用示例

#### 使用 JavaScript 调用

```javascript
async function main() {
  const apiKey = 'your-api-key'
  const apiUrl = 'https://aiproxy.hzh.sealos.run/v1/chat/completions'
  
  const response = await fetch(apiUrl, {
      method: 'POST',
      headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${apiKey}`
      },
      body: JSON.stringify({
          model: 'Doubao-lite-4k',
          messages: [
              { role: 'system', content: 'You are a helpful assistant.' },
              { role: 'user', content: '你好，请介绍一下你自己。' }
          ],
          max_tokens: 2048,
          temperature: 0.7,
      }),
  })
  
  const data = await response.json()
  console.log(data.choices[0].message.content)
}
```

### 3. 请求参数说明

| 参数 | 类型 | 说明 | 示例值 |
|------|------|------|--------|
| model | string | 要使用的模型名称 | 'Doubao-lite-4k' |
| messages | array | 对话消息列表 | [{"role": "user"}] |
| max_tokens | number | 最大生成的 token 数量 | 2048 |
| temperature | number | 生成文本的随机性，范围 0-1 | 0.7 |

## 费用管理

### 查看费用明细

1. 在 AI Proxy 界面中点击【费用明细】
2. 可查看各模型的调用次数和费用统计
3. 支持按时间范围筛选费用记录

### 余额充值
1. 进入 Sealos 费用中心
2. 选择充值金额
3. 完成支付后即可使用充值金额调用模型

## 调用日志

### 日志查看

- 支持查看详细的 API 调用记录
- 包含调用时间、模型名称、输入输出 token 数量等信息

### 日志筛选

- 按时间范围筛选
- 按模型类型筛选
- 按 Token 筛选

## 最佳实践

### 开发建议

1. 合理设置 `max_tokens` 参数，避免生成过长的无效内容
2. 根据场景调整 `temperature` 参数，对话场景建议使用较高的值
3. 在生产环境中做好异常处理和重试机制

### 成本优化

1. 选择适合业务场景的模型
2. 合理设置上下文长度，避免无效的 token 消耗

## 常见问题

### API 调用失败

- 检查 API Key 是否正确
- 确认账户余额是否充足
- 查看具体的错误信息进行排查

### 费用相关

- 费用按实际调用量计费
- 不同模型的计费标准不同
- 支持查看详细的计费规则

---

### Archived 5.0 Docs User Guide App Launchpad Add Domain (`docs/archived/5.0/docs/user-guide/app-launchpad/add-domain.md`)

---
sidebar_position: 2
keywords: [custom domain, Sealos, app deployment, domain provider, public access]
description: Learn how to assign a custom domain to your project using Sealos for a tailored brand experience. Follow our step-by-step guide for seamless app deployment.
---

# Add a domain

Assigning a custom domain to your project guarantees that visitors to your application will have a tailored experience
that aligns with your brand.

## When Deploying

Just enable "Public Access" when you're deploying, and [Sealos](https://cloud.sealos.io) will sorts you out with a
domain.



Now, on your domain provider's end, link the 'CNAME' to the one Sealos provided.

Once it's active, jump back to Sealos, click on "Custom Domain" to the side:



Enter your custom domain in the pop-up box and click confirm.



To wrap up, click the "Deploy" button. Once your app's live, click on the external address to access the app via the
custom domain.

## Post Deployment

For the apps you've deployed, just click "Update" top-right on the app details page. Then, follow the earlier steps to
integrate your custom domain.

---

### Archived 5.0 Docs User Guide App Launchpad App Launchpad (`docs/archived/5.0/docs/user-guide/app-launchpad/app-launchpad.md`)

---
sidebar_position: 0
keywords: [App Launchpad, Sealos, application deployment, private images, horizontal pod autoscaling]
description: App Launchpad in Sealos simplifies application deployment with features like private images, HPA, custom domains, and real-time monitoring.
---

# App Launchpad

**App Launchpad** is a feature within Sealos that serves as a single-image deployment tool. Its main goal is to
streamline and expedite the process of deploying applications, allowing you to launch your application in as little as 5
minutes.

The tool currently boasts a range of functionalities:

- Capability to deploy applications using private images.
- Flexibility to tailor CPU and memory resources according to the specific needs of the application.
- Support for deploying multiple replicas.
- Horizontal Pod Autoscaling (HPA) for dynamic scaling.
- Provision of external URLs for easy access from the public network.
- Option to assign custom domain to applications, enhancing both brand visibility and the user experience.
- Utilization of ConfigMap for configuration file management.
- Persistent storage solutions for application data, ensuring both its security and continuity.
- Real-time monitoring features for applications and Pods to facilitate prompt issue detection and resolution.
- Comprehensive logging of application activities, aiding in troubleshooting and performance optimization.
- Analysis of system events (Events) to extract critical insights for enhancing application performance.
- A convenient one-click feature to access the container terminal, simplifying management and debugging tasks.
- Ability to expose several ports of an application to the external network.

## [Quick Start](./use-app-launchpad.md)

For quick and easy installation of commonly utilized applications.

## [Update Application](./update-app.md)

Guidance on modifying application configurations after initial deployment.

## [Add a domain](./add-domain.md)

Instructions for integrating a custom domain with your application.

## [Exposing Multiple Ports](./expose-multi-ports.md)

Details on how to make multiple ports of an application accessible externally.

## [Environment](./environment.md)

Directions for configuring applications through the use of environment variables.

## [ConfigMap](./configmap.md)

Guidelines for setting up application configurations via configuration files.

## [Autoscaling](./autoscale.md)

Strategy for autoscaling the number of application instances in response to varying workloads.

## [Persistent Volume](./persistent-volume.md)

Utilizing persistent storage for the long-term preservation of data.

---

### Archived 5.0 Docs User Guide App Launchpad Autoscale (`docs/archived/5.0/docs/user-guide/app-launchpad/autoscale.md`)

---
sidebar_position: 6
keywords: [Sealos, Autoscaling, Horizontal Pod Autoscaler, HPA, application scaling, CPU usage, memory usage, cloud scaling, Sealos controller, performance monitoring]
description: Learn how Sealos' Autoscaling feature dynamically adjusts application instances based on CPU and memory usage, ensuring optimal performance and resource utilization.
---

# Autoscaling

In [Sealos](https://cloud.sealos.io), the "[App Launchpad](/guides/applaunchpad/applaunchpad.md)" feature enables the
automatic adjustment of application instance numbers to effectively respond to varying load conditions. This
functionality is known as "**Autoscaling**," or more technically, the Horizontal Pod Autoscaler (HPA).

Autoscaling operates by dynamically altering the count of application instances based on specific metrics like CPU and
memory usage. This ensures that the applications run efficiently and resources are optimally utilized.

> Key Point: In Autoscaling, "usage" typically refers to the average use across all instances of an application. For
> example, if an app runs on two instances, its average CPU usage is calculated as the mean of the usage of these two
> instances.

The workings of Autoscaling are as follows:

1. **Monitoring**: It continuously monitors crucial performance indicators like CPU and memory usage.
2. **Decision Making**: Based on predefined thresholds (e.g., maintaining CPU usage below 50%), it calculates the
   required adjustments in the instance count.
3. **Adjustment**: Following this, Autoscaling automatically instructs the Sealos controller to modify the number of
   instances, ensuring the usage stays within the desired range.

For instance, if we set up an application with specific Autoscaling rules such as a maximum CPU usage of 50% and the
ability for instance numbers to vary between 1 and 5, Autoscaling will:

- Increase the number of instances when the average CPU usage exceeds 50%, up to a maximum of 5.
- Decrease the number of instances when the average CPU usage drops below 50%, but always maintain at least one instance
  in operation.

---

### Archived 5.0 Docs User Guide App Launchpad Configmap (`docs/archived/5.0/docs/user-guide/app-launchpad/configmap.md`)

---
sidebar_position: 5
keywords: [Sealos, configuration files, Nginx container, environment variables, application settings]
description: Learn how to effectively manage application settings in Sealos using configuration files, including Nginx container setup and environment variables.
---

# ConfgMap

In [Sealos](https://cloud.sealos.io), the implementation of configuration files plays a vital role, particularly when
the application deals with numerous or complex configurations. Differing from environment variables, configuration files
are a more versatile and dependable means for managing settings. Environment variables are more apt for simple,
small-scale configuration tasks.

The primary strength of configuration files is their capability to hold and control elaborate configuration data,
including aspects like configuration files, command-line arguments, and environment variables. These pieces of data can
be incorporated into the container upon the launch of the application container, facilitating adjustments to the
application's functionalities without the necessity of recompiling the image.

Take, for example, the Nginx container. The utilization of configuration files in this context can be described as
follows:

- **Filename**: This pertains to a file within the Nginx container, for which references can be drawn from the
  instructions provided by the image supplier.
- **File Value**: This is the content corresponding to the file. In cases where the content is elaborate, it's
  recommended to complete editing it offline and then paste it into the specified location.
- **Key Points**: The approach involves mounting an individual file, not an entire directory. It is imperative to
  precisely identify the file to be mounted, rather than just a directory path.

---

### Archived 5.0 Docs User Guide App Launchpad Environment (`docs/archived/5.0/docs/user-guide/app-launchpad/environment.md`)

---
sidebar_position: 4
keywords: [Sealos, environment variables, container applications, configuration management, App Launchpad]
description: Learn how to manage configuration data for container applications in Sealos using environment variables for better maintainability and scalability.
---

# Environment

In [Sealos](https://cloud.sealos.io), environment variables are pivotal in managing the configuration data for container
applications. These variables enable the provision of essential configuration information to applications without
necessitating changes to the application's code or image, thus bolstering their maintainability and scalability.

The process of defining environment variables in the "[App Launchpad](/guides/applaunchpad/applaunchpad.md)" interface
is streamlined through a bulk input method. Users can define multiple variables by entering them line by line. Each
variable comprises a key and a value, separated by either an equal sign (=) or a colon (:). The interface is designed to
automatically eliminate any invalid characters from the key, ensuring the accuracy and validity of the environment
variables.



**Environment Variable Formats That Are Correctly Interpreted:**

```shell
host=127.0.0.1
port:3000
name: sealos
- username=123
- password:123
# Comments like this line are ignored, as they don't include an equal sign (=) or a colon (:), which are the key markers.
```

**Environment Variable Formats That Cannot Be Interpreted:**

```shell
host=127.0.0.1 # This line is interpreted because it contains an equal sign (=) or a colon (:). The comment here is also considered part of the variable due to the preceding equal sign (=).
```

---

### Archived 5.0 Docs User Guide App Launchpad Expose Multi Ports (`docs/archived/5.0/docs/user-guide/app-launchpad/expose-multi-ports.md`)

---
sidebar_position: 3
keywords: [multi-port application, expose multiple ports, Sealos platform, app launchpad, network configuration]
description: Learn how to expose multiple ports for complex applications using Sealos App Launchpad. Simplify network configuration and enhance accessibility.
---

# Exposing Multiple Ports

In complex application environments, it's common for services to expose multiple ports simultaneously to cater to
diverse needs. These requirements can emerge from various scenarios:

+ **Multi-protocol support**: For example, an application might support both HTTP and HTTPS, necessitating the exposure
  of both ports 80 and 443.
+ **Multi-functional application**: An application might have a web service and an admin service, both of which listen
  on different ports.
+ **Compatibility considerations**: To remain compatible with older versions or other services, you might need to expose
  ports for both the new and old interfaces.
+ **Combined Database + App**: For instance, if you have an application and a database within the same Pod, you might
  need to expose ports for both the application and the database.
+ **Prometheus Monitoring and App Service**: If your application has a business port and another port for Prometheus
  monitoring via `/metrics`, you might need to expose both.
+ **Coexistence of GRPC and RESTful services**: If your application offers both GRPC and RESTful services, you might
  need to expose separate ports for each type of service.

When deploying applications using "[App Launchpad](/guides/applaunchpad/applaunchpad.md)"
on [Sealos](https://cloud.sealos.io), you can easily choose to expose multiple ports. During the deployment process,
users simply click on the "Network" option and then select "Add Port" to configure multiple ports.



Furthermore, the Sealos platform offers external access to these ports. Once exposed to the public network, each port
will be assigned a unique sub-domain, facilitating easier remote access and management.

---

### Archived 5.0 Docs User Guide App Launchpad Persistent Volume (`docs/archived/5.0/docs/user-guide/app-launchpad/persistent-volume.md`)

---
sidebar_position: 7
keywords: [persistent storage, data persistence, container storage, Sealos, external storage, container deployment, data retention, Nextcloud, application container]
description: Ensure data persistence in Sealos with external storage solutions, maintaining data continuity even through container restarts or redeployments.
---

# Persistent Volume

[Sealos](https://cloud.sealos.io) offers a flexible environment where containers can be effortlessly created and
destroyed. This flexibility is advantageous for application deployment and management, but it also raises the issue of
maintaining data persistence. In scenarios where data is stored within an application container, its destruction leads
to the loss of all stored data.

To counter this problem, the use of persistent storage is essential. Persistent storage ensures that data is stored
externally, thereby preserving it even through container restarts or redeployments. This is particularly vital for
applications requiring data retention, like databases, file storage systems, or any services involving user data.

For instance, in deploying Nextcloud, all data associated with its container is located in the `/var/www/html`
directory. To maintain data continuity, it's necessary to use external storage solutions for persisting data in this
directory.

---

### Archived 5.0 Docs User Guide App Launchpad Set Cert (`docs/archived/5.0/docs/user-guide/app-launchpad/set-cert.md`)

---
sidebar_position: 8
keywords: [custom domain certificate, cert-manager, Kubernetes secret, ingress patch, App Launchpad]
description: Learn how to manually set up a custom domain certificate in App Launchpad using Kubernetes secrets and ingress patching.
---

# Set a Custom Domain Certificate

Successfully set up a custom domain in "App Launchpad" but cannot access the domain, and it shows the certificate is not
secure. This is because cert-manager did not successfully issue the certificate. To resolve this issue, we can manually
set up the certificate.

First, make sure you have successfully set up CNAME in your cloud provider and have downloaded the certificate
corresponding to your domain.

Open "App Launchpad", set a custom domain.



Open the "Terminal", and execute the following commands in sequence.

```bash
# Create tls.crt using the certificate file information (replace xxxx with the actual certificate file information).
cat > tls.crt <<EOF
-----BEGIN CERTIFICATE-----
xxxx
-----END CERTIFICATE-----
EOF

# Create tls.key using the certificate private key information (replace xxxx with the actual private key information).
cat > tls.key <<EOF
-----BEGIN RSA PRIVATE KEY-----
xxxx
-----END RSA PRIVATE KEY-----
EOF

# Create a secret using tls.crt and tls.key.
kubectl create secret tls network-test --cert tls.crt --key tls.key

# Check the ingress for the corresponding application.
kubectl get ingress 
```



Modify the ingress (replace xzy-dev.sealos.run with your own custom domain).

```bash
kubectl patch ingress network-twvuqmjzckur -p '{"spec":{"tls":[{"hosts":["xzy-dev.sealos.run"],"secretName":"network-test"}]}}'
```



Test the effect.

---

### Archived 5.0 Docs User Guide App Launchpad Update App (`docs/archived/5.0/docs/user-guide/app-launchpad/update-app.md`)

---
sidebar_position: 1
keywords: [Sealos, update application, app settings, cloud platform, deploy app]
description: Update your application settings on Sealos easily. Click the "Update" button on the app details page to make changes anytime.
---

# Update app

After deploying an application on [Sealos](https://cloud.sealos.io), you can update the application settings at any
time. Just click the "Update" button at the top-right of the app details page. When you're done, click on the "Update"
button at the top-right.

---

### Archived 5.0 Docs User Guide App Launchpad Use App Launchpad (`docs/archived/5.0/docs/user-guide/app-launchpad/use-app-launchpad.md`)

---
sidebar_position: 1
keywords: [Sealos desktop, App Launchpad, cloud operating system, install applications, deploy nginx]
description: Learn how to use Sealos desktop's App Launchpad to quickly install and deploy applications like Nginx on the cloud operating system.
---

# Use App Launchpad

Sealos desktop is similar to that of PC operating systems, such as macOS or Windows. Each icon on the desktop represents
an app, similar to the shortcuts in Windows. Like PC operating systems, Sealos also comes with built-in apps. To quickly
install applications on this cloud operating system, you need to use the system's built-in **App Launchpad**.

This guide will show you how to quickly install some common applications on the Sealos cloud operating system.

## Deploy nginx

Open Sealos desktop and click App Launchpad.



Click on New Application.

Enter the application name and image name in sequence, enable external network access, and then click "Deploy
Application" to proceed.



Once the deployment is finished, click Details to enter the application's detailed view.

you can view the operational metrics of the Nginx application, including CPU and memory usage. Click on the external
link to open the Nginx interface directly via the external domain name.

---

--- METRICS ---
- Files Extracted: 99
- Estimated Token Budget: ~76136 tokens
- Canonical Reference: https://codewiki.google/github.com/labring/sealos
