Skip to content

Instantly share code, notes, and snippets.

View bharatmicrosystems's full-sized avatar
😀

Gaurav Agarwal bharatmicrosystems

😀
View GitHub Profile
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
ingress-nginx-controller-6b6855f9cb-78b7j 1/1 Running 0 3m33s 10.4.3.7 gke-cluster-1-preemtible-pool-ce21ea76-mknh <none> <none>
ingress-nginx-controller-6b6855f9cb-7b4kx 1/1 Running 0 4m53s 10.4.2.4 gke-cluster-1-preemtible-pool-ce21ea76-zb7c <none> <none>
ingress-nginx-controller-6b6855f9cb-7mfql 1/1 Running 0 5m2s 10.4.2.3 gke-cluster-1-preemtible-pool-ce21ea76-zb7c <none> <none>
ingress-nginx-controller-6b6855f9cb-826fw 1/1 Running 0 5m2s 10.4.3.3 gke-cluster-1-preemtible-pool-ce21ea76-mknh <none> <none>
ingress-nginx-controller-6b6855f9cb-9rfjq 1/1 Running 0 3m33s 10.4.3.8 gke-cluster-1-preemtible-pool-ce21ea76-mknh <none> <none>
ingress-nginx-controller-6b6855
NAME CPU(cores) MEMORY(bytes)
ingress-nginx-controller-6b6855f9cb-78b7j 2m 57Mi
ingress-nginx-controller-6b6855f9cb-7b4kx 2m 61Mi
ingress-nginx-controller-6b6855f9cb-7mfql 3m 58Mi
ingress-nginx-controller-6b6855f9cb-826fw 7m 60Mi
ingress-nginx-controller-6b6855f9cb-9rfjq 2m 57Mi
ingress-nginx-controller-6b6855f9cb-glvh7 2m 57Mi
ingress-nginx-controller-6b6855f9cb-gvkrr 2m 57Mi
ingress-nginx-controller-6b6855f9cb-h9zkg 3m 58Mi
ingress-nginx-controller-6b6855f9cb-k7jg8 25m 61Mi
NAME CPU(cores) MEMORY(bytes)
ingress-nginx-controller-6b6855f9cb-sj4mw 3m 56Mi
ingress-nginx-controller-6b6855f9cb-wl29h 2m 55Mi
cat <<EOF | kubectl apply -f -
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
kubernetes.io/ingress.class: nginx
spec:
rules:
$ kubectl get pod -n ingress-nginx -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
ingress-nginx-controller-6b6855f9cb-sj4mw 1/1 Running 0 19m 10.4.2.2 gke-cluster-1-preemtible-pool-ce21ea76-zb7c <none> <none>
ingress-nginx-controller-6b6855f9cb-wl29h 1/1 Running 0 101s 10.4.3.2 gke-cluster-1-preemtible-pool-ce21ea76-mknh <none> <none>
cat <<EOF | kubectl apply -f -
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: hpa-ingress-nginx-controller
namespace: ingress-nginx
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
$ kubectl get node
NAME STATUS ROLES AGE VERSION
gke-cluster-1-default-pool-17734f1e-2zdk Ready <none> 5m56s v1.16.13-gke.1
gke-cluster-1-default-pool-17734f1e-dsht Ready <none> 5m56s v1.16.13-gke.1
gke-cluster-1-preemtible-pool-ce21ea76-mknh Ready <none> 4m46s v1.16.13-gke.1
gke-cluster-1-preemtible-pool-ce21ea76-zb7c Ready <none> 4m46s v1.16.13-gke.1
gcloud container node-pools create preemtible-pool \
--cluster [CLUSTER_NAME] \
--zone [CLUSTER_ZONE] \
--scopes cloud-platform \
--enable-autoupgrade \
--preemptible \
--num-nodes 2 \
--node-taints cloud.google.com/gke-preemptible="true":NoSchedule \
--enable-autoscaling --min-nodes=2 --max-nodes=6
gcloud beta container clusters create "cluster-1" \
--zone [CLUSTER_ZONE] \
--no-enable-basic-auth --cluster-version "1.16.13-gke.1" \
--num-nodes "2" \
--enable-stackdriver-kubernetes --enable-ip-alias \
--default-max-pods-per-node "110" \
--no-enable-master-authorized-networks \
--enable-autoupgrade --enable-autorepair
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
helloworld-go-thmmb-1-deployment-77976785f5-6cthr 2/2 Running 0 59s
helloworld-go-thmmb-1-deployment-77976785f5-7dckg 2/2 Running 0 59s
helloworld-go-thmmb-1-deployment-77976785f5-fdvjn 0/2 Pending 0 57s
helloworld-go-thmmb-1-deployment-77976785f5-gt55v 0/2 Pending 0 58s
helloworld-go-thmmb-1-deployment-77976785f5-rwwcv 2/2 Running 0 59s
helloworld-go-thmmb-1-deployment-77976785f5-tbrr7 2/2 Running 0 58s
helloworld-go-thmmb-1-deployment-77976785f5-vtnz4 0/2 Pending 0 58s
helloworld-go-thmmb-1-deployment-77976785f5-w8pn6 2/2 Running 0 59s