Skip to content

Instantly share code, notes, and snippets.

@embano1
Created October 17, 2019 14:54
Show Gist options
  • Save embano1/276c81c7bccd4606ad6866c7173d2a1f to your computer and use it in GitHub Desktop.
Save embano1/276c81c7bccd4606ad6866c7173d2a1f to your computer and use it in GitHub Desktop.
Bill kind

kindcfg

kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 5432
    hostPort: 5432
  - containerPort: 80
    hostPort: 8080

Postgres example

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: gitlab-postgresql
  namespace: gitlab
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: gitlab-postgresql
    spec:
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      containers:
      - name: postgresql
        image: sameersbn/postgresql:9.5-3
        imagePullPolicy: Always
        env:
        - name: DB_USER
          value: gitlab
        - name: DB_PASS
          value: +BP52QIxpT/flVCMpL3KXA==
        - name: DB_NAME
          value: gitlab_production
        - name: DB_EXTENSION
          value: pg_trgm
        ports:
        - name: postgres
          containerPort: 5432
        volumeMounts:
        - mountPath: /var/lib/postgresql
          name: data
        livenessProbe:
          exec:
            command:
            - pg_isready
            - -h
            - localhost
            - -U
            - postgres
          initialDelaySeconds: 30
          timeoutSeconds: 5
        readinessProbe:
          exec:
            command:
            - pg_isready
            - -h
            - localhost
            - -U
            - postgres
          initialDelaySeconds: 5
          timeoutSeconds: 1
      volumes:
      - name: data
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: gitlab-postgresql
  namespace: gitlab
  labels:
    name: gitlab-postgresql
spec:
  ports:
    - name: postgres
      port: 5432
      targetPort: postgres
  selector:
    name: gitlab-postgresql

nginx example

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    run: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      run: nginx
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: nginx
    spec:
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
        resources: {}
status: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment