You are on page 1of 1

alias k=kubectl

kubectl create deploy my-nginx --image=nginx --dry-run=client -o yaml


kubectl expose deploy my-nginx --port=80 --dry-run=client -o yaml
alias k='kubectl'
switch name space using "kubens <namespace>"
To update the version of nginx in the deployment, execute the following command:
-->kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1 --record
--> kubectl rollout status deployment.v1.apps/nginx-deployment
--> kubectl rollout history deployment nginx-deployment
kubectl explain --recursive pod

create a cluster command


gcloud container clusters create nginx-tutorial \
--machine-type e2-small \
--num-nodes 2

unlabel name-space
kubectl label namespace default istio-injection-

to see images versions of all pods


kubectl get pods -o jsonpath --template='{range .items[*]}{.metadata.name}{"\t"}{"\
t"}{.spec.containers[0].image}{"\n"}{end}'

to see service end points


kubectl describe services monolith | grep Endpoint

The cpu-percent flag specifies 50% as the target average CPU utilization of
requested CPU over all the pods. HPA will adjust the number of replicas (via the
deployment)
to maintain an average CPU utilization of 50% across all pods.

kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10

kubectl get hpa

update pod with env varaibles


kubectl set env deployment/cartservice REDIS_ADDR=${REDIS_IP}:${REDIS_PORT} \
-n ${NAMESPACE}

namespaces
switch to a namespace permanently using command
$ kubectl config set-context $(kubectl config current-context_ --namespace hello

You might also like