k8s启动pgrouting

前言
该服务可提供路由功能

1. yml文件

apiVersion: v1
kind: ReplicationController
metadata:
  name: pgrouting
  namespace: crust-gis
  labels:
    name: pgrouting
spec:
  replicas: 1
  selector:
    name: pgrouting
  template:
    metadata:
      labels:
        name: pgrouting
    spec:
      containers:
      - name: pgrouting
        image: pgrouting/pgrouting:12-3.0-2.6.3
        ports:
        - containerPort: 5432
        resources:
          requests:
            cpu: "250m"
            memory: "64Mi"
          limits:
            cpu: "2000m"
            memory: "8Gi"
        volumeMounts:
        - name: pgrouting-data
          mountPath: /var/lib/postgresql/data
        env:
        - name: POSTGRES_PASSWORD
          value: "liubei@2021"
      volumes:
      - name: pgrouting-data
        persistentVolumeClaim:
          claimName: pgrouting-data-pvc
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pgrouting-data-pvc
  namespace: crust-gis
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 20Gi
  storageClassName: nfs-client
---
apiVersion: v1
kind: Service
metadata:
  name: pgrouting
  namespace: crust-gis
  labels:
    name: pgrouting
spec:
  type: NodePort
  ports:
  - port: 5432
    targetPort: 5432
    nodePort: 30507
  selector:
    name: pgrouting

2. 数据导入

2.1 创建库

CREATE EXTENSION "uuid-ossp";
CREATE EXTENSION postgis;
CREATE EXTENSION pgrouting;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION address_standardizer;

2.2 导入数据

>>>下载导入sql脚本


![在这里插入图片描述](https://img-blog.csdnimg.cn/60e027eb7cac45678ef91a29b8a3aed1.png#pic_center)

posted on 2021-08-16 22:56  运维开发玄德公  阅读(4)  评论(0编辑  收藏  举报  来源

导航