虚拟化容器,大数据,DBA,中间件,监控。

k8s部署kodexplorer(八)

11 11月
作者:admin|分类:容器虚拟化

k8s部署kodexplorer

1.准备kodexplorer的docker镜像

1)导入镜像
[root@k8s-master kod]# docker load -i centos69_kod.tar.gz 
aaa5621d7c01: Loading layer [==================================================>] 202.4 MB/202.4 MB
b5fefd57f2f8: Loading layer [==================================================>] 4.608 kB/4.608 kB
586d863cc8b4: Loading layer [==================================================>] 6.656 kB/6.656 kB
51f05d552585: Loading layer [==================================================>] 311.6 MB/311.6 MB
f1596c077b94: Loading layer [==================================================>]  7.68 kB/7.68 kB
353c38446257: Loading layer [==================================================>] 3.584 kB/3.584 kB
18e48d57f8c3: Loading layer [==================================================>]  2.56 kB/2.56 kB
12d3b827a2cc: Loading layer [==================================================>]  13.9 MB/13.9 MB
45adcea93dc6: Loading layer [==================================================>]  47.5 MB/47.5 MB
afb19e45d160: Loading layer [==================================================>]  12.8 kB/12.8 kB
6785dbe0715c: Loading layer [==================================================>]  2.56 kB/2.56 kB
Loaded image: centos69_kod_df:v4=======>                                        ]    512 B/2.56 kB


2)给镜像打标签
[root@k8s-master kod]# docker tag centos69_kod_df:v4 192.168.81.240/k8s/kodexplorer:v4

3)推送至镜像仓库
[root@k8s-master kod]# docker push 192.168.81.240/k8s/kodexplorer:v4

2.编写deployment配置文件

[root@k8s-master kod]# vim kod_deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: kod-deploy
spec:
  replicas: 5
  template:
    metadata:
      labels:
        app: kodnginx						//标签
    spec:
      containers:
      - name: nginxkod
        image: 192.168.81.240/k8s/kodexplorer:v4
        ports:
        - containerPort: 80

3.编写svc配置文件

[root@k8s-master kod]# vim kod_svc.yaml 
appVersion: v1
kind: Service
metadata:
  name: nginx-kod
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
  selector:
    app: kodnginx				//关联deployment的标签

4.创建资源

[root@k8s-master kod]# kubectl create -f kod_deployment.yaml
service "nginx-kod" created
[root@k8s-master kod]# kubectl create -f kod_svc.yaml 
service "nginx-kod" created

5.查看资源

在这里插入图片描述

6.访问站点kod

在这里插入图片描述

浏览497 评论0
返回
目录
返回
首页
k8s hpa弹性伸缩和namespace(十) k8s持久化存储pv、pvc(七)