Kubernetes(2)Docker and Quickstart

Kubernetes(2)Docker and Quickstart

I already have the docker on my MAC, try to run redis
> docker run -d redis

> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
82800f7eb4cc redis "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 6379/tcp jolly_dubinsky

Enter that Redis docker
> docker exec -it 82800f7eb4cc /bin/bash

Once we are in that docker application, we can see the redis is running
> ps -ef | grep redis
redis 1 0 0 02:57 ? 00:00:00 redis-server *:6379
root 25 18 0 03:02 pts/0 00:00:00 grep redis

Get telnet back on my MAC
https://dor.ky/restore-telnet-in-mac-os-high-sierra-10-13/
> brew install telnet

Check if we can telnet to the Redis, No, because we did not mapping the port
> telnet localhost 6379
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

Stop and remove the Redis application
>docker stop 82800f7eb4cc
82800f7eb4cc
>docker rm 82800f7eb4cc
82800f7eb4cc

Dynamic mapping
> docker run -d -P redis

We can telnet then
> telnet localhost 32768
Trying ::1...
Connected to localhost.
Escape character is '^]'.
STATS
-ERR unknown command 'STATS'
QUIT
+OK
Connection closed by foreign host.

Or mapping as follow
> docker run -d -p 6379:6379 redis

> telnet localhost 6379
Trying ::1...
Connected to localhost.
Escape character is '^]'.
MONITOR
+OK
QUIT
+OK
Connection closed by foreign host.

Set Up Kubernetes
The configuration file is here
/Users/hluo/.kube/config
/Users/hluo/.kube/config-dev
/Users/hluo/.kube/config-stage

Config is the one for my local kubernetes, the dev is for company’s DEV, stage is for stage.

Change and Switch the Kube Config
> export KUBECONFIG=~/.kube/config-dev
> echo $KUBECONFIG
/Users/hluo/.kube/config-dev

Check the cluster info
> kubectl cluster-info

Start the proxy
> kubectl proxy
Starting to serve on 127.0.0.1:8001

Visit the UI
http://localhost:8001/ui

Hapened to delete the minikube in VirtualBox, restart that with these command
> rm -rf ~/.minikube
> minikube start

Check my Kubernetes
> export KUBECONFIG=~/.kube/config

> kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443
KubeDNS is running at https://192.168.99.100:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

> kubectl proxy
Starting to serve on 127.0.0.1:8001

UI page is here
http://192.168.99.100:30000

Stop the local cluster
> minikube stop


References:
http://sillycat.iteye.com/blog/2415445
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值