17 Ocak 2023 Salı

kubectl config rename-context seçeneği

Örnek
Şöyle yaparız
# Fetch the Kubernetes cluster credentials
gcloud container clusters get-credentials \
  <<kubernetes_cluster_name_output_from_gke_primary>>
  --zone=europe-west4 \
  --project=<<your_gcp_project_id>>

gcloud container clusters get-credentials \
  <<kubernetes_cluster_name_output_from_gke_secondary>> \
  --zone=europe-west2 \
  --project=<<your_gcp_project_id>>

# Update kubectl context for simplicity
kubectl config rename-context \
  gke_<<your_gcp_project_id>>_europe-west4_<<kubernetes_cluster_name_output_from_gke_primary>> \
  gke_pri

kubectl config rename-context \
  gke_<<your_gcp_project_id>>_europe-west2_<<kubernetes_cluster_name_output_from_gke_secondary>> \
  gke_sec
Ve şöyle yapabiliriz
# 1
kubectl config use-context gke_pri
kubectl apply -f namespace.yaml
kubectl apply -f deployment.yaml

# 2
kubectl config use-context gke_sec
kubectl apply -f namespace.yaml
kubectl apply -f deployment.yaml

Hiç yorum yok:

Yorum Gönder

Kubernetes kind: Cluster

Örnek Şöyle yaparız apiVersion: cluster.k8s.io/v1alpha1 kind: Cluster metadata: name: my-cluster spec: autoscaler: enabled: true ...