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

Kubernetes 1.5 deploy sonarqube

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

In the previous blog posts, we have been talking about the installation and deployment of the basic environment of kubernetes. After the deployment of the underlying environment, we began to try to use kubernetes to manage our application. This blog post shows you how to deploy an application through deployment and service through a simple example. Let's take deploying a sonarqube as an example.

Sonarqube is a code review tool that consists of two parts, the web site and the database. We create another sonarqube directory under the directory / data/kubernetes where all the yml files are stored, and generate the following four files:

[root@server-116 sonarqube] # ll-htotal 16K Murray RW Murray Rafe Murray. 1 root root 682 Mar 15 23:25 mysql-sonar-dm.yml-rw-r--r--. 1 root root 209 Mar 15 23:35 mysql-sonar-svc.yml-rw-r--r--. 1 root root 669 Mar 16 09:46 sonar-dm.yml-rw-r--r--. 1 root root 151 Mar 15 23:30 sonar-svc.yml

Mysql-sonar-dm.yml and mysql-sonar-svc.yml are used to create the database used by sonarqube, as follows:

Vim mysql-sonar-dm.ymlapiVersion: extensions/v1beta1kind: Deploymentmetadata: name: mysql-sonarspec: replicas: selector:# app: mysql-sonar template: metadata: labels: app: mysql-sonarspec: containers:-name: mysql-sonar p_w_picpath: myhub.fdccloud.com/library/mysql:5.6 ports:-containerPort: 3306 env:-name: MYSQL_ROOT_PASSWORD value: "mysoft"-name: MYSQL_DATABASE value: sonardb

Vim mysql-sonar-svc.ymlapiVersion: v1kind: Service metadata: name: mysql-sonarspec: type: NodePort ports:-port: 3306 targetPort: 3306 nodePort: 30002 selector: app: mysql-sonar

Sonar-dm.yml and sonar-svc.yml are used to create pod and service for sonar, respectively, as follows:

Vim sonar-dm.ymlapiVersion: extensions/v1beta1kind: Deploymentmetadata: name: sonarspec: replicas: 1 # selector: # app: sonar template: metadata: labels: app: sonarspec: containers:-name: sonar p_w_picpath: myhub.fdccloud.com/library/sonarqube:6.2 ports:-containerPort: 9000 env:-name: SONARQUBE_JDBC_USERNAME Value: sonar-name: SONARQUBE_JDBC_PASSWORD value: sonar-name: SONARQUBE_JDBC_URL value: "jdbc:mysql://mysql-sonar:3306/sonardb?useSSL=false&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"

Vim sonar-svc.ymlapiVersion: v1kind: Servicemetadata: name: sonarspec: type: NodePort ports:-port: 9000 nodePort: 30001 selector: app: sonar

Start the sonar application:

Kubectl create-f / data/kubernetes/sonarqube/

Access sonarqube through http://:30001:

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

Database

Wechat

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

12
Report