k8s启动gitlab服务

[root@master gitlab]# ll
total 8
-rw-r–r-- 1 root root 460 Apr 13 04:55 gitlab_deployment.yaml
-rw-r–r-- 1 root root 315 Apr 12 08:16 gitlab_service.yaml

[root@master gitlab]# cat gitlab_deployment.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: giblab
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitlab
  template:
    metadata:
      labels:
        app: gitlab
    spec:
      containers:
      - name: gitlab
        image: 192.168.200.20/library/gitlab-ce:12.9.2-ce.0
        ports:
        - name: http
          containerPort: 80
        - name: ssh
          containerPort: 22
        - name: htts
          containerPort: 443
[root@master gitlab]# cat gitlab_service.yaml 
apiVersion: v1
kind: Service
metadata:
  name: gitlab-service
  labels:
    app: gitlab
spec:
  type: NodePort
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: ssh
      port: 22
      targetPort: ssh
    - name: htts
      port: 443
      targetPort: htts
  selector:
    app: gitlab
apiVersion: apps/v1
kind: Deployment
metadata:
  name: giblab
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitlab
  template:
    metadata:
      labels:
        app: gitlab
    spec:
      containers:
      - name: gitlab
        image: 10.18.4.10/library/gitlab-ce:12.9.2-ce.0
        ports:
        - name: http
          containerPort: 80
        - name: ssh
          containerPort: 22
        - name: htts
          containerPort: 443
---
apiVersion: v1
kind: Service
metadata:
  name: gitlab-service
  labels:
    app: gitlab
spec:
  type: NodePort
  selector:
    app: gitlab
  ports:
    - name: http
      port: 80
      targetPort: http
      nodePort: 30006
    - name: ssh
      port: 22
      targetPort: ssh
      nodePort: 30007
    - name: htts
      port: 443
      targetPort: htts
      nodePort: 30008

查看pods

[root@master gitlab]#	kubectl get pods
[root@master gitlab]#	kubectl describe pod giblab-f6cf75779-9jvqm
[root@master gitlab]#	kubectl logs -f giblab-f6cf75779-9jvqm

猜你喜欢

转载自blog.csdn.net/m0_52426915/article/details/116002921