Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy your own web platform with K8s

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to deploy your own web platform with K8s". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to deploy your own web platform with K8s.

1. Create a mariadb image and initialize the database in Dockerfile. Source code:

Https://github.com/zhanggq/mariadb

two。 Create your own web image, which is written in go at the back end and amaze at the front end. Open port 8082 is not available for the source code.

3. Create and paste yaml on Dashboard to start mariadb rc

ApiVersion: v1

Kind: ReplicationController

Metadata:

Name: mysql

Spec:

Replicas: 1

Selector:

App: mysql

Template:

Metadata:

Labels:

App: mysql

Spec:

Containers:

-image: registry.cn-hangzhou.aliyuncs.com/zhanggq/mariadb:v10.1

Name: mysql

Resources:

Limits:

Cpu: "2"

Memory: 2Gi

Ports:

-containerPort: 3306

Env:

-name: MYSQL_ROOT_PASSWORD

Value: "123456"

4. Start mariadb svc

ApiVersion: v1

Kind: Service

Metadata:

Name: mysql

Spec:

Ports:

-name: mysql-svc

Port: 3306

TargetPort: 3306

NodePort: 31101

Selector:

App: mysql

Type: NodePort

5. Start amaze rc

ApiVersion: v1

Kind: ReplicationController

Metadata:

Name: amaze

Spec:

Replicas: 1

Selector:

App: amaze

Template:

Metadata:

Labels:

App: amaze

Spec:

Containers:

-image: registry.cn-hangzhou.aliyuncs.com/zhanggq/amaze:v1.0

Name: amaze

Resources:

Limits:

Cpu: "1"

Memory: 1Gi

Ports:

-containerPort: 8082

6. Start amaze svc

ApiVersion: v1

Kind: Service

Metadata:

Name: amaze

Spec:

Ports:

-name: amaze-svc

Port: 8082

TargetPort: 8082

NodePort: 30082

Selector:

App: amaze

Type: NodePort

Problems encountered

1. Docker launches the container and reports an error:

Docker: Error response from daemon: mkdir / var/lib/docker/overlay/64d4cbac6ef69d5b84fc753e83dc2849f14e43177d0e9d

A532eb61499ce7e2fc-init/merged/dev/shm: invalid argument.

Solution: upgrade the kernel

Original kernel Kernel Version: 3.10.0-229.el7.x86_64

Upgraded kernel 4.6.0-1.el7.elrepo.x86_64

two。 Manually change the configuration in the web application and remotely connect to the mysql database 10.233.104.69

At this point, I believe you have a deeper understanding of "how to deploy your own web platform with K8s". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report