Skip to content

Instantly share code, notes, and snippets.

@roamingthings
Created March 15, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roamingthings/767947370debb1cfd64b773d5f85e8a9 to your computer and use it in GitHub Desktop.
Save roamingthings/767947370debb1cfd64b773d5f85e8a9 to your computer and use it in GitHub Desktop.
A cheatsheet for Kubernetes

Kubernetes Cheatsheet

Minikube

Start
$ minikube start
Stop
$ minikube stop
Go to dashboard
$ minikube dashboard
Url of a service
minikube service --url <servicename>
Put URL of a service into a variable
$ export NODE_PORT=$(kubectl get --namespace <service> -o jsonpath="{.spec.ports[0].nodePort}" services wordpress-wordpress)                                                  ✓  10374  10:15:42
$ export NODE_IP=$(kubectl get nodes --namespace <service>> -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT

Fabric8

Note
Don’t forget to remove SNAPSHOT from the release
Perform a build and prepare for Kubernetes
mvn package fabric8:build
Generate the Kubernetes resource
mvn fabric8:resource

Generated in classes/META-INF/fabric8

mvn fabric8:apply

Random

Wordpress password
echo Password: $(kubectl get secret --namespace wordpress wordpress-wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment