Docker Swarm to Kubernetes

uuuu.jini·2022년 10월 17일
0
  • kompose convert
  • docker crt 등록(server.crt) - 모든 노드
  • /etc/hosts 도메인 등록 - 모든 노드
  • daemon.json: insecurity 등록 - 모든 노드
  • docker & kubernetes restart
  • deployment yaml: imagepullsecret 설정
  • pvc 설정위해 pv 생성 필요!

PV 생성


elasticsearch-persistenvolumeclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: elasticsearch
  name: elasticsearch
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

filebeat-claim0-persistentvolumeclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: filebeat-claim0
  name: filebeat-claim0
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

filebeat-claim1-persistentvolumeclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: filebeat-claim1
  name: filebeat-claim1
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

filebeat-persistentvolumeclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: filebeat
  name: filebeat
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

visualizer-claim0-persistentvolumeclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: visualizer-claim0
  name: visualizer-claim0
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

pv.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/Volumes/Data"

Pod

eleasticsearch-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-stack.yml
    kompose.version: 1.26.1 (a9d05d509)
  creationTimestamp: null
  labels:
    io.kompose.service: elasticsearch
  name: elasticsearch
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: elasticsearch
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert -f docker-stack.yml
        kompose.version: 1.26.1 (a9d05d509)
      creationTimestamp: null
      labels:
        io.kompose.network/elk: "true"
        io.kompose.service: elasticsearch
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - sysdev3
      containers:
        - env:
            - name: ES_JAVA_OPTS
              value: -Xmx192m -Xms192m
            - name: discovery.type
              value: single-node
          image: lightvision:5000/elasticsearch:latest
          name: elasticsearch
          ports:
            - containerPort: 9200
            - containerPort: 9300
          resources: {}
          volumeMounts:
            - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
              name: elastic-config
              subPath: elasticsearch.yml
            - mountPath: /usr/share/elasticsearch/data
              name: elasticsearch
      restartPolicy: Always
      volumes:
        - configMap:
            items:
              - key: elasticsearch.yml
                path: elasticsearch.yml
            name: elastic-config
          name: elastic-config
        - name: elasticsearch
          persistentVolumeClaim:
            claimName: elasticsearch
status: {}
  • filebeat pvc 생성

  • filebeat log 파일 생성 필요(모든 노드)

        securityContext:
          runAsUser: 0
          와 왜돼?
  • elasticsearch: 경로 변경! (/var/lib/elasticserach/data)

profile
멋쟁이 토마토

0개의 댓글