kubernetes部署harbor
本文章介绍kubernetes上部署harbor服务,且最终以http访问harbor
参考:https://github.com/goharbor/harbor-helm
部署方式
1、下载项目代码(master主机执行)
1
git clone https://gitee.com/yushanjin/kubernetes-harbor
2、提前创建本地目录,并修改权限(harbor主机执行)
1
2
3
4
5
6
7
8
mkdir -p /data/harbor/registry-data
mkdir -p /data/harbor/trivy-data
mkdir -
阅读全文〉
K8S部署有状态服务mysql
参考:[https://kubernetes.io/zh/docs/tasks/run-application/run-replicated-stateful-application/]https://kubernetes.io/zh/docs/tasks/run-application/run-replicated-stateful-application/
部署 MySQL
MySQL 示例部署包含一个 ConfigMap、两个 Service 与一个 StatefulSet。
创建 ConfigMap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
apiV
阅读全文〉
go中String Int转换
GO数值和字符串的相互转换,借助strconv包的函数来转换
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main
import (
"fmt"
"strconv"
)
func main() {
myAgeString := "26"
fmt.Printf("My Age: %s\n", myAgeString)
ageValue1, err := strconv.Atoi(myAgeString)
if err != nil {
fmt.Pr
阅读全文〉
go 数据库操作
准备测试数据
连接MySQL
1
mysql -uroot -proot@12345
选择数据库test
1
2
CREATE DATABASE IF NOT EXISTS `test`;
USE `test`;
创建测试用的user表和order表,并插入测试数据
1
2
3
4
5
6
7
8
9
#创建user表
DROP TABLE IF EXISTS `order`;
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (`uid` SERIAL PRIMARY KEY, `name`
阅读全文〉
kubernetes with containerd
参考:https://www.hi-linux.com/posts/10148.html
前提条件
已安装kata container及containerd with CRI plugin
1
2
3
4
5
6
7
8
9
10
root@ubuntu-001:~# kata-runtime --version
kata-runtime : 1.13.0-alpha0
commit : <>
OCI specs: 1.0.1-dev
root@ubuntu-001:~# containerd --version
containerd contai
阅读全文〉
containerd with kata-container
参考:https://github.com/kata-containers/documentation/blob/master/how-to/containerd-kata.md
前提条件
已安装kata container及containerd with CRI plugin
1
2
3
4
5
6
7
8
9
10
root@ubuntu-001:~# kata-runtime --version
kata-runtime : 1.13.0-alpha0
commit : <>
OCI specs: 1.0.1-dev
root@ubuntu-
阅读全文〉
docker with kata-container
前提条件
1. Ubuntu 18.04
2. 已安装docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
root@ubuntu-001:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
root@ubuntu-00
阅读全文〉
go中的defer关键字
摘自:https://tiancaiamao.gitbooks.io/go-internals/content/zh/03.4.html
defer和go一样都是Go语言提供的关键字。defer用于资源的释放,会在函数返回之前进行调用。一般采用如下模式:
1
2
3
4
5
f,err := os.Open(filename)
if err != nil {
panic(err)
}
defer f.Close()
如果有多个defer表达式,调用顺序类似于栈,越后面的defer表达式越先被调用。
不过如果对defer的了解不够深入,使用起来可能会踩到一些坑,尤其是跟带命
阅读全文〉
有用的链接
2020-12-24
/
技术链接简介SimpleCVhttp://simplecv.org/开源的机器视觉库(对OpenCV python库的封装,对python3不支持)xxx$16草莓$17
阅读全文〉
kubernetes部署httpd服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
root@ubuntu-001:~# cat httpd.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd
spec:
replicas: 1
selector:
matchLabels:
阅读全文〉