Giter Site home page Giter Site logo

xxbb1234021 / k8s-docker-for-mac Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maguowei/k8s-docker-desktop-for-mac

1.0 2.0 0.0 435 KB

Docker Desktop (Mac) 开启并使用 Kubernetes

Home Page: https://github.com/maguowei/kubernetes-for-china

Shell 100.00%

k8s-docker-for-mac's Introduction

Docker Desktop (Mac) 开启并使用 Kubernetes

Docker Desktop 已经可以简单的启用 Kubernetes 集群, 为学习 Kubernetes 提供了极大的便利, 但是由于众所周知的原因, 国内的网络下不能很方便的下载 Kubernetes 集群所需要的镜像文件, 导致集群启用失败. 这里提供了一个简单的方法, 利用阿里云的镜像服务, 预先下载镜像文件, 以方便 Kubernetes 学习和使用。

说明:

  • 本设置在Docker Desktop (Mac) Version 2.0.4.0 (33772) Channel: edge (Kubernetes: v1.14.1)上经过测试可用

  • 使用 KubeadmUbuntu上安装 Kubernetes 请查看 kubernetes-for-china

安装并设置

  1. 下载安装 Docker Desktop (Mac) Channel: edge

  2. 设置 Docker **官方镜像加速 registry mirror https://registry.docker-cn.com

mirror

  1. 预先从阿里云Docker镜像下载 Kubernetes 所需要的镜像, 可以通过修改 ./images 文件定制你自己需要的镜像
$ ./load_images.sh
  1. Docker for Mac 设置中启用 Kubernetes 选项, 并等待一会儿,直到 Kubernetes 开始运行。

k8s

  1. 可选的步骤: 切换Kubernetes运行上下文至 docker-desktop
# 一般只有在之前用其他方式运行过Kubernetes才需要
$ kubectl config use-context docker-desktop
  1. 验证 Kubernetes 集群状态
$ kubectl cluster-info
$ kubectl get nodes
$ kubectl describe node
  1. 部署 Kubernetes dashboard
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

# 开启本机访问代理
$ kubectl proxy

通过下面的连接访问 Dashboard: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

创建Dashboard管理员用户并用Token登陆: https://github.com/kubernetes/dashboard/wiki/Creating-sample-user

# 用 homebrew 安装 Helm
$ brew install kubernetes-helm

# 初始化本地 CLI 并 将 Tiller 安装到 Kubernetes cluster
$ helm init

# 更新本地 charts repo
$ helm repo update

# 安装 mysql chart
$ helm install --name my-mysql stable/mysql

# 删除 mysql
$ helm delete my-mysql

# 删除 mysql 并释放该名字以便后续使用
$ helm delete --purge my-mysql

参考

k8s-docker-for-mac's People

Contributors

denverdino avatar maguowei avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.