반응형

Nginx Ingress Controller 사용시 Nginx 와 관련된 기본적인 설정할 때 Annotaions기능을 통해 적용할 수 있다

예를들면 기본적으로 Nginx Ingress Controller 에 client_max_body_size 가 1m로 설정되어있는데,

ingress.yaml 의 Annotations을 통해 Nginx Controller Pod에 접속하지 않아도 Nginx 설정을 할 수 있다.

 

단, Nginx Ingress Controller의 경우 kubernetes Ingress Controller(Community Version)와

Nginx Ingress Controller가 있는데, 이를 잘 보고 적용해야한다.

 

1. kubernetes Ingress Controller(Community Version)

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cafe-ingress-with-annotations
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 8m   
spec:
  rules:
     ...

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/

 

2. Nginx Ingress Controller

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cafe-ingress-with-annotations
  annotations:
    nginx.org/client-max-body-size: 4m
spec:
  rules:
     ...

https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations

 

 

반응형

'Develop > k8s' 카테고리의 다른 글

ETCD Leader 및 List 조회  (0) 2023.11.21
k8s pods 전체 삭제 및 특정 이름 전체 삭제  (0) 2023.11.09
Ubuntu 20.04 kubernetes(k8s) 설치  (0) 2023.08.21
k8s Docker Private Registry(Nexus, Harbor) secret  (0) 2023.01.16
Pod Scheduling  (0) 2022.09.26
반응형

Nginx Error Page 처리방법으로는 error_page를 먼저 선언하고 뒤에 에러코드

그리고 표시할 html 파일 이름을 작성한 후 location을 선언한다.

location 안에는 html 파일경로를 작성한다.

또한, 한번에 여러 에러를 같은 페이지로 처리하기 위해서는 500 501 502 이런식으로 선언하여 사용한다.

server {

    error_page 400 /error_400.html;
    location = /error_400.html {
        root /usr/error/;
    }
    
    error_page 404 /error_404.html;
    location = /error_404.html {
    	root /usr/error/;
    }
    
    error_page 500 501 502 /error_500.html;
    location = /error_500.html {
    	root /usr/error/;
    }
}

 

 

간혹 에러페이지를 선언하였지만, 해당 에러페이지로 가지 않을 땐

발생하는 해당 location에 proxy_intercept_errors on;을 선언한다.

server {

	
    error_page 400 /error_400.html;
    location = /error_400.html {
        root /usr/error/;
    }
    
    error_page 404 /error_404.html;
    location = /error_404.html {
    	root /usr/error/;
    }
    
    error_page 500 501 502 /error_500.html;
    location = /error_500.html {
    	root /usr/error/;
    }
    
    location /api/test {
    	proxy_intercept_errors on;
    }
}

 

반응형
반응형

Jenknis 에서 Git Checkout 할 경우 파일 용량이 클 때 아래와 같이 기본으로 사용할 경우 10분이 넘어갈 경우 timeout 이 발생한다.

pipeline {
    agent any 
    stages {
        stage('checkout') { 
            steps {
                git branch: 'master', credentialsId: 'credentialsId', url: 'git Repo URL"
            }
        }

    }
}

 

이를 해결하기 위해 스크립트를 사용할 경우 아래와 같이 사용하여 timeout 시간을 늘려준다.

pipeline {
    agent any 
    stages {
        stage('checkout') { 
            steps {
                checkout([
                	$class: "GitSCM",
                	branche: [[name: "master"]],
                	extensions: [
                    	[$class: "CheckoutOption", timeout: 120],
                    	[$class: "CloneOption", timeout: 120]
                    ],
                	gitTool "Default",
                	userRemoteConfigs: [[credentialsId: "credentialsId", url: "git Repo URL"]]
                ])
            }
        }

    }
}

 

반응형

+ Recent posts