Last active
December 15, 2017 01:50
-
-
Save ikuwow/2a9af388df503da386d6c8889d93b02b to your computer and use it in GitHub Desktop.
Minikubeを触ってみる、gcr.ioのプライベートレジストリからimageをpullしてみる ref: https://qiita.com/ikuwow/items/2c734a3fdb6c56322839
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ minikube | |
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows. | |
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 Retrieve 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. | |
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' | |
start Starts a local kubernetes cluster. | |
status Gets the status of a local kubernetes cluster. | |
stop Stops a running local kubernetes cluster. | |
version Print the version of minikube. | |
Flags: | |
--alsologtostderr log to standard error as well as files | |
-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 (default "") | |
--logtostderr log to standard error instead of files | |
--show-libmachine-logs Deprecated: To enable libmachine logs, set --v=3 or higher | |
--stderrthreshold severity logs at or above this threshold go to stderr (default 2) | |
--use-vendored-driver Use the vendored in drivers instead of RPC | |
-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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl apply -f sample.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME READY STATUS RESTARTS AGE | |
sample-deployoment-145882439-n7213 1/1 Running 0 3m | |
sample-deployoment-145882439-zrzg5 1/1 Running 0 3m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install kubectl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ minikube start | |
Starting local Kubernetes cluster... | |
Starting VM... | |
Downloading Minikube ISO | |
89.51 MB / 89.51 MB [==============================================] 100.00% 0s | |
SSH-ing files into VM... | |
Setting up certs... | |
Starting cluster components... | |
Connecting to cluster... | |
Setting up kubeconfig... | |
Kubectl is now configured to use the cluster. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080 | |
deployment "hello-minikube" created |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl get deploy | |
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE | |
hello-minikube 1 1 1 0 48s | |
$ kubectl get po | |
NAME READY STATUS RESTARTS AGE | |
hello-minikube-938614450-zwlkn 0/1 ContainerCreating 0 1m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ minikube dashboard | |
Opening kubernetes dashboard in default browser... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl create secret docker-registry gcr \ | |
--docker-server=https://gcr.io \ | |
--docker-username=oauth2accesstoken \ | |
--docker-password="$(gcloud auth print-access-token)" \ | |
[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "gcr-json-key"}]}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
annotations: | |
deployment.kubernetes.io/revision: "1" | |
name: sample-deployoment | |
namespace: default | |
spec: | |
selector: | |
matchLabels: | |
name: sample | |
replicas: 2 | |
template: | |
spec: | |
containers: | |
- image: gcr.io/{youriamge}/{yourimage}:latest | |
name: sample-container | |
metadata: | |
labels: | |
name: sample |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment