Skip to content

Instantly share code, notes, and snippets.

@rvennam
Last active September 6, 2018 15:13
Show Gist options
  • Save rvennam/091915b737a7f9fe4e811f481cd98c38 to your computer and use it in GitHub Desktop.
Save rvennam/091915b737a7f9fe4e811f481cd98c38 to your computer and use it in GitHub Desktop.
IBM Cloud, Kubernetes and Istio cheat sheet
# Token
kubectl config view | grep token | cut -f 2 -d ":" | tr -d " ";
# Ease of use
ibmcloud cr info
ibmcloud cr namespace-list
export MYNAMESPACE=<NAMESPACE> # export MYNAMESPACE=rvennam
export MYREGISTRY=<REGISTRY> # export MYREGISTRY=registry.ng.bluemix.net
# Build image
docker build . -t ${MYREGISTRY}/${MYNAMESPACE}/myapp:v1.0.0
# Push image to registry
docker push ${MYREGISTRY}/${MYNAMESPACE}/myapp:v1.0.0
# Create deployment
kubectl run myapp --image=${MYREGISTRY}/${MYNAMESPACE}/myapp:v1.0.0
# Create service and expose with load balancer
kubectl expose --namespace=default deployment myapp --port=9080 --target-port=80 --type=LoadBalancer
# Delete apps
helm delete myapp --purge
kubectl delete --ignore-not-found=true svc,pvc,deployment -l app=myapp
kubectl delete --ignore-not-found=true -f kubernetes/myappdeployment.yaml
# Delete the secret from the cluster
kubectl delete secret my-secret
# Delete the entire cluster
ibmcloud cs cluster-rm yourclustername
# Delete the images from your container registry
ibmcloud cr image-rm ${MYREGISTRY}/${MYNAMESPACE}/myapp
# Shell
kubectl run my-shell --rm -i --tty --image rvennam/myubuntu -- bash
# Connect to IBM Cloud Service
ibmcloud resource service-alias-create myobjectstorage --instance-name myobjectstorage
ibmcloud cs cluster-service-bind --cluster my-cluster --namespace default --service myobjectstorage
# Expose service
kubectl expose --namespace=default deployment nginx --port=80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment