Featured image of post 用Minikube体验单节点K8S

用Minikube体验单节点K8S

year-map

Usage: minikube [command]

Available Commands: addons Modify minikube’s kubernetes addons completion Outputs minikube shell completion for the given shell (bash) config Modify minikube config dashboard Opens/displays the kubernetes dashboard URL for your local cluster delete Deletes a local kubernetes cluster docker-env Sets up docker env variables; similar to ‘$(docker-machine env)’ get-k8s-versions Gets the list of available kubernetes versions available for minikube ip Retrieves the IP address of the running cluster logs Gets the logs of the running localkube instance, used for debugging minikube, not user code mount Mounts the specified directory into minikube profile Profile sets the current minikube profile service Gets the kubernetes URL(s) for the specified service in your local cluster ssh Log into or run a command on a machine with SSH; similar to ‘docker-machine ssh’ ssh-key Retrieve the ssh identity key path of the specified cluster start Starts a local kubernetes cluster status Gets the status of a local kubernetes cluster stop Stops a running local kubernetes cluster update-context Verify the IP address of the running cluster in kubeconfig. version Print the version of minikube

Flags: –alsologtostderr log to standard error as well as files -b, –bootstrapper string The name of the cluster bootstrapper that will set up the kubernetes cluster. (default “localkube”) -h, –help help for minikube –log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) –log_dir string If non-empty, write log files in this directory –loglevel int Log level (0 = DEBUG, 5 = FATAL) (default 1) –logtostderr log to standard error instead of files -p, –profile string The name of the minikube VM being used. This can be modified to allow for multiple minikube instances to be run independently (default “minikube”) –stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, –v Level log level for V logs –vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

Use “minikube [command] –help” for more information about a command.

Starting local Kubernetes v1.7.5 cluster… Starting VM… Getting VM IP address… Moving files into cluster… Setting up certs… Connecting to cluster… Setting up kubeconfig… Starting cluster components… Kubectl is now configured to use the cluster.

We have now launched an echoserver pod but we have to wait until the pod is up before curling/accessing it

via the exposed service

To check whether the pod is up and running we can use the following

$ kubectl get pod NAME READY STATUS RESTARTS AGE hello-minikube-3383150820-vctvh 1/1 ContainerCreating 0 3s

We can see that the pod is still being created from the ContainerCreating status

$ kubectl get pod NAME READY STATUS RESTARTS AGE hello-minikube-3383150820-vctvh 1/1 Running 0 13s

We can see that the pod is now Running and we will now be able to curl it

$ curl $(minikube service hello-minikube –url) CLIENT VALUES: client_address=172.17.0.2 command=GET real path=/ query=nil request_version=1.1 request_uri=http://192.168.99.100:8080/

SERVER VALUES: server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED: accept=/ host=192.168.99.100:31721 user-agent=curl/7.54.0 BODY: -no body in request-%

$ APISERVER=$(kubectl config view | grep https | cut -f 2- -d “:” | tr -d " “)

$ curl $APISERVER –header “Authorization: Bearer $TOKEN” –insecure { “paths”: [ “/api”, “/api/v1”, “/apis”, “/apis/”, “/apis/admissionregistration.k8s.io”, “/apis/admissionregistration.k8s.io/v1alpha1”, “/apis/apiextensions.k8s.io”, “/apis/apiextensions.k8s.io/v1beta1”, “/apis/apiregistration.k8s.io”, “/apis/apiregistration.k8s.io/v1beta1”, “/apis/apps”, “/apis/apps/v1beta1”, “/apis/authentication.k8s.io”, “/apis/authentication.k8s.io/v1”, “/apis/authentication.k8s.io/v1beta1”, “/apis/authorization.k8s.io”, “/apis/authorization.k8s.io/v1”, “/apis/authorization.k8s.io/v1beta1”, “/apis/autoscaling”, “/apis/autoscaling/v1”, “/apis/autoscaling/v2alpha1”, “/apis/batch”, “/apis/batch/v1”, “/apis/batch/v2alpha1”, “/apis/certificates.k8s.io”, “/apis/certificates.k8s.io/v1beta1”, “/apis/extensions”, “/apis/extensions/v1beta1”, “/apis/networking.k8s.io”, “/apis/networking.k8s.io/v1”, “/apis/policy”, “/apis/policy/v1beta1”, “/apis/rbac.authorization.k8s.io”, “/apis/rbac.authorization.k8s.io/v1alpha1”, “/apis/rbac.authorization.k8s.io/v1beta1”, “/apis/settings.k8s.io”, “/apis/settings.k8s.io/v1alpha1”, “/apis/storage.k8s.io”, “/apis/storage.k8s.io/v1”, “/apis/storage.k8s.io/v1beta1”, “/healthz”, “/healthz/autoregister-completion”, “/healthz/ping”, “/healthz/poststarthook/apiservice-registration-controller”, “/healthz/poststarthook/apiservice-status-available-controller”, “/healthz/poststarthook/bootstrap-controller”, “/healthz/poststarthook/ca-registration”, “/healthz/poststarthook/extensions/third-party-resources”, “/healthz/poststarthook/generic-apiserver-start-informers”, “/healthz/poststarthook/kube-apiserver-autoregistration”, “/healthz/poststarthook/start-apiextensions-controllers”, “/healthz/poststarthook/start-apiextensions-informers”, “/healthz/poststarthook/start-kube-aggregator-informers”, “/healthz/poststarthook/start-kube-apiserver-informers”, “/logs”, “/metrics”, “/swagger-2.0.0.json”, “/swagger-2.0.0.pb-v1”, “/swagger-2.0.0.pb-v1.gz”, “/swagger.json”, “/swaggerapi”, “/ui”, “/ui/”, “/version” ] }%

year-map

署名-非商业性使用-禁止演绎 4.0 (CC BY-NC-ND 4.0)
comments powered by Disqus
本博客始于 2007 年
Built with Hugo
主题 StackJimmy 设计