Example Kubernetes Pipeline

 stages:

  - build

  - deploy


variables:

  KUBECONFIG: "/path/to/kubeconfig"

  KUBE_NAMESPACE: "your-namespace"


before_script:

  - echo "Starting the CI/CD Pipeline"


build:

  stage: build

  script:

    - echo "Build stage, typically used for building Docker images, running tests, etc."

    - docker build -t your-image:latest .

    - docker push your-image:latest


deploy:

  stage: deploy

  script:

    - echo "Deploying to Kubernetes"

    - kubectl apply -f k8s/deployment.yaml -n $KUBE_NAMESPACE

    - kubectl apply -f k8s/service.yaml -n $KUBE_NAMESPACE

    - kubectl apply -f k8s/ingress.yaml -n $KUBE_NAMESPACE

  only:

    - main


Comments

Popular posts from this blog

Delploy Cluster : Managed K8 & Self Managed K8

ctr | nerdctl | crictl

Deploy To Kubernetes with Jenkins GitOps GitHub Pipeline