Minikube: Kubectl

From OnnoWiki
Revision as of 07:32, 6 May 2023 by Onnowpurbo (talk | contribs) (Created page with "Sumber: https://minikube.sigs.k8s.io/docs/handbook/kubectl/ Kubectl Use kubectl inside minikube By default, kubectl gets configured to access the kubernetes cluster control p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sumber: https://minikube.sigs.k8s.io/docs/handbook/kubectl/

Kubectl Use kubectl inside minikube By default, kubectl gets configured to access the kubernetes cluster control plane inside minikube when the minikube start command is executed.

However if kubectl is not installed locally, minikube already includes kubectl which can be used like this:

minikube kubectl -- <kubectl commands>

You can also alias kubectl for easier usage.

alias kubectl="minikube kubectl --"

Alternatively, you can create a symbolic link to minikube’s binary named ‘kubectl’.

ln -s $(which minikube) /usr/local/bin/kubectl

Get pods

minikube kubectl -- get pods

Creating a deployment inside kubernetes cluster

minikube kubectl -- create deployment hello-minikube --image=kicbase/echo-server:1.0

Exposing the deployment with a NodePort service

minikube kubectl -- expose deployment hello-minikube --type=NodePort --port=8080

For more help

minikube kubectl -- --help

Shell autocompletion

After applying the alias or the symbolic link you can follow https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion to enable shell-autocompletion.



Referensi

Pranala Menarik