Peringatan : Sebaiknya jangan gunakan tanda ini karena dapat merusak banyak fitur. Biasanya, ESP menggunakan konfigurasi nginx yang dihasilkan dari flag start up-nya. Jika konfigurasi nginx kustom disediakan dengan flag `-n`, konfigurasi nginx yang dihasilkan tidak akan digunakan dan ESP tidak akan berfungsi dengan benar.
Metode yang direkomendasikan untuk menghasilkan konfigurasi nginx kustom adalah:
Men-deploy container ESP dengan tanda startup yang tepat
Salin konfigurasi nginx yang dihasilkan dari /etc/nginx/endpoints/nginx.conf
Terapkan perubahan Anda ke salinan nginx.config yang dibuat
Langkah-langkah di atas harus diulang setiap kali versi ESP baru digunakan atau tanda start up berubah.
Jika Anda ingin menggunakan nginx.conf
kustom di Google Kubernetes Engine, siapkan dengan
memperluas
contoh nginx.conf ini.
Berikut adalah cuplikan konfigurasi yang diperlukan oleh Cloud Endpoints:
Sekarang buat Configmap Kubernetes dengan nginx.conf
kustom Anda menggunakan kubectl
:
kubectl create configmap nginx-config --from-file= nginx.conf
Edit file konfigurasi Kubernetes seperti
esp_echo_custom_config_gke.yaml
dan ganti SERVICE_NAME
dengan nama layanan Endpoint Anda.
Terakhir, mulai layanan dengan file konfigurasi Kubernetes yang diupdate menggunakan
kubectl
.
kubectl create -f esp_echo_custom_config_gke.yaml