본문 바로가기
kubenetes

k8s nifi ingress

by kyeongseo.oh 2022. 10. 6.

zookeeper yaml link 

https://kyeongseo.tistory.com/entry/k8s-nifi-zookeeper

 

k8s nifi-1.13.2 zookeeper-3.6.3

k8s에서 zookeeper cluster와 nifi cluster를 실행한다. version name version zookeeper 3.6.3 nifi 1.13.2 기본 apache nifi 이미지는 flow.xml.gz 파일의 위치 및 각 repository의 위치를 수정할 수 없기에 doc..

kyeongseo.tistory.com

 

nifi yaml

service를 NodePort가 아닌 ClusterIP로 생성한다.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nifi
spec:
  selector:
    matchLabels:
      app: nifi
  serviceName: nifi-hs
  replicas: 3
  updateStrategy:
    type: RollingUpdate
  podManagementPolicy: OrderedReady
  template:
    metadata:
      labels:
        app: nifi
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: "app"
                    operator: In
                    values:
                    - nifi
              topologyKey: "kubernetes.io/hostname"
      containers:
      - name: nifi
        image: "oks529/nifi:1.13.2"
        env:
        - name: NIFI_CLUSTER_IS_NODE
          value: "true"
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NIFI_CLUSTER_ADDRESS
          value: $(HOSTNAME).nifi-hs.default.svc.cluster.local
        - name: NIFI_CLUSTER_NODE_PROTOCOL_PORT
          value: "1025"
        - name: NIFI_WEB_HTTP_HOST
          value: $(HOSTNAME).nifi-hs.default.svc.cluster.local
        #- name: NIFI_WEB_HTTP_PORT
        #  value: "80"
        - name: NIFI_CLUSTER_NODE_PROTOCOL_MAX_THREADS
          value: "100"
        - name: NIFI_ZK_CONNECT_STRING
          value: "zk-0.zk-hs.default.svc.cluster.local:2181,zk-1.zk-hs.default.svc.cluster.local:2181,zk-2.zk-hs.default.svc.cluster.local:2181"
        - name: NIFI_ELECTION_MAX_CANDIDATES
          value: "3"
        - name: NIFI_FLOW_CONFIGURATION_FILE
          value: "/data/flow.xml.gz"
        - name: NIFI_DATABASE_DIRECTORY
          value: "/data/database_repository"
        - name: NIFI_FLOWFILE_REPOSITORY_DIRECTORY
          value: "/data/flowfile_repository"
        - name: NIFI_CONTENT_REPOSITORY_DIRECTORY_DEFAULT
          value: "/data/content_repository"
        - name: NIFI_PROVENANCE_REPOSITORY_DIRECTORY_DEFAULT
          value: "/data/provenance_repository"
        - name: TZ
          value: Asia/Seoul
        ports:
        - containerPort: 8080
          name: client
        - containerPort: 1025
          name: nodeport
        volumeMounts:
        - name: nifi-data
          mountPath: /data
      securityContext:
        runAsUser: 0
        runAsGroup: 1000
        fsGroup: 1000
  volumeClaimTemplates:
  - metadata:
      name: nifi-data
    spec:
      accessModes: ["ReadWriteMany"]
      resources:
        requests:
          storage: 5Gi
      storageClassName: "nfs-client"		
---
kind: Service
apiVersion: v1
metadata:
  name: nifi
  namespace: default
  labels:
    app: nifi
spec:
  type: ClusterIP
  selector:
    app: nifi
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
      name: nifi
---
kind: Service
apiVersion: v1
metadata:
  name: nifi-hs
spec:
  clusterIP: None
  selector:
    app: nifi
  ports:
    - port: 8081
      targetPort: 8081
      name: nifi-listen-http
    - port: 2881
      targetPort: 2881
      name: nifi-site-protocol
    - port: 2882
      targetPort: 2882
      name: nifi-node-protocol

 

nifi ingress yaml

proxy_pass와 proxy_set_header에는 nifi service의 ClusterIP를 작성한다.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: HTTP
    nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS
    nginx.ingress.kubernetes.io/cors-allow-origin: '*'
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/proxy-ssl-server-name: "on"
    nginx.ingress.kubernetes.io/server-snippet: "location ~ /nifi {
         proxy_pass http://10.96.124.123;
         proxy_set_header Host $http_host;
         proxy_set_header Origin http://10.96.124.123;
      }"
  labels:
    app.kubernetes.io/instance: nifi
  name: nifi-ingress
  namespace: default
spec:
  rules:
  - http:
      paths:
      - backend:
          service:
            name: nifi
            port:
              number: 8080
        path: /nifi
        pathType: Prefix

 

ip:ingress_컨트롤러의_NodePort/nifi 로 접속한다.

'kubenetes' 카테고리의 다른 글

nerfstuio viewer image build  (0) 2023.10.18
kubeflow 1.7.0 설치  (0) 2023.08.29
k8s nifi-1.17.0  (0) 2022.10.03
k8s nifi-1.13.2 zookeeper-3.6.3  (1) 2022.10.02
kubeadm join 시 pending  (0) 2022.09.30

댓글