minikube国内在线部署体验
问题描述:
快速学习k8s的各个组件的作用及yml的编写,minikube很适合。
how to install Minikube, a tool that runs a single-node Kubernetes cluster in a virtual machine on your personal computer
参考文档:
https://kubernetes.io/docs/tasks/tools/install-minikube/
https://minikube.sigs.k8s.io/docs/start/linux/
https://github.com/kubernetes/minikube
实验环境:
ubuntu16.04 LTS
2C4G,在线环境
virtualbox虚拟化的形式部署
01、检查是否支持虚拟化
grep -E --color 'vmx|svm' /proc/cpuinfo //注意不支持则不能继续安装

02、Install kubectl
#binary
https://github.com/kubernetes/kubectl/releases //源码需要编译
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version //检查是否可以直接执行

03、Install a Hypervisor
VirtualBox //如果没配置国内mirror请参考 https://opsx.alibaba.com/mirror
user@slave:~$ sudo apt show virtualbox
Package: virtualbox
Version: 5.1.38-dfsg-0ubuntu1.16.04.3
Priority: optional
Section: multiverse/misc
Origin: Ubuntu
sudo apt install -y virtualbox //执行安装virtualbox到ubuntu中
04、启动minikube
###下载minikube文件
https://github.com/kubernetes/minikube/releases
https://github.com/kubernetes/minikube/releases/download/v1.4.0/minikube-linux-amd64 //Kubernetes version to v1.16.0
chmod +x minikube
sudo mv minikube /usr/local/bin

注意:minikube在虚拟化中启动,不能用root账户启动
minikube --help //查看命令参数
user@slave:~$ minikube --help
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows. Basic Commands:
start Starts a local kubernetes cluster //启动本地虚拟化/主机的k8s单节点
status Gets the status of a local kubernetes cluster
stop Stops a running local kubernetes cluster
delete Deletes a local kubernetes cluster
dashboard Access the kubernetes dashboard running within the minikube cluster
Images Commands:
docker-env Sets up docker env variables; similar to '$(docker-machine env)'
cache Add or delete an image from the local cache. Configuration and Management Commands:
addons Modify minikube's kubernetes addons
config Modify minikube config
profile Profile gets or sets the current minikube profile
update-context Verify the IP address of the running cluster in kubeconfig. Networking and Connectivity Commands:
service Gets the kubernetes URL(s) for the specified service in your local cluster
tunnel tunnel makes services of type LoadBalancer accessible on localhost Advanced Commands:
mount Mounts the specified directory into minikube
ssh Log into or run a command on a machine with SSH; similar to 'docker-machine ssh'
kubectl Run kubectl Troubleshooting Commands:
ssh-key Retrieve the ssh identity key path of the specified cluster
ip Retrieves the IP address of the running cluster
logs Gets the logs of the running instance, used for debugging minikube, not user code.
update-check Print current and latest version number
version Print the version of minikube Other Commands:
completion Outputs minikube shell completion for the given shell (bash or zsh) Use "minikube <command> --help" for more information about a given command.
minikube start --help //很重要启动参数
user@slave:~$ minikube start --help
Starts a local kubernetes cluster Options:
--apiserver-ips=[]: A set of apiserver IP Addresses which are used in the generated certificate for kubernetes.
This can be used if you want to make the apiserver available from outside the machine
--apiserver-name='minikubeCA': The apiserver name which is used in the generated certificate for kubernetes. This
can be used if you want to make the apiserver available from outside the machine
--apiserver-names=[]: A set of apiserver names which are used in the generated certificate for kubernetes. This
can be used if you want to make the apiserver available from outside the machine
--apiserver-port=: The apiserver listening port
--cache-images=true: If true, cache docker images for the current bootstrapper and load them into the machine.
Always false with --vm-driver=none.
--container-runtime='docker': The container runtime to be used (docker, crio, containerd).
--cpus=2: Number of CPUs allocated to the minikube VM. //最低的,CPU2个
--cri-socket='': The cri socket path to be used.
--disable-driver-mounts=false: Disables the filesystem mounts provided by the hypervisors
--disk-size='20000mb': Disk size allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or
g). //磁盘大小
--dns-domain='cluster.local': The cluster dns domain name used in the kubernetes cluster
--dns-proxy=false: Enable proxy for NAT DNS requests (virtualbox driver only)
--docker-env=[]: Environment variables to pass to the Docker daemon. (format: key=value)
--docker-opt=[]: Specify arbitrary flags to pass to the Docker daemon. (format: key=value)
--download-only=false: If true, only download and cache files for later use - don't install or start anything.
--embed-certs=false: if true, will embed the certs in kubeconfig.
--enable-default-cni=false: Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with
"--network-plugin=cni".
--extra-config=: A set of key=value pairs that describe configuration that may be passed to different components.
The key should be '.' separated, and the first part before the dot is the component to apply the configurat
ion to. Valid components are: kubelet, kubeadm, apiserver, controller-manager, etcd, proxy, scheduler
Valid kubeadm parameters: ignore-preflight-errors, dry-run, kubeconfig, kubeconfig-dir, node-name, cri-sock
et,experimental-upload-certs, certificate-key, rootfs, pod-network-cidr
--feature-gates='': A set of key=value pairs that describe feature gates for alpha/experimental features.
--force=false: Force minikube to perform possibly dangerous operations
--host-dns-resolver=true: Enable host resolver for NAT DNS requests (virtualbox driver only)
--host-only-cidr='192.168.99.1/24': The CIDR to be used for the minikube VM (virtualbox driver only)
--hyperkit-vpnkit-sock='': Location of the VPNKit socket used for networking. If empty, disables Hyperkit
VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock (hyperkit driver only)
--hyperkit-vsock-ports=[]: List of guest VSock ports that should be exposed as sockets on the host (hyperkit
driver only)
--hyperv-virtual-switch='': The hyperv virtual switch name. Defaults to first found. (hyperv driver only)
--image-mirror-country='': Country code of the image mirror to be used. Leave empty to use the global one. For
Chinese mainland users, set it to cn.
--image-repository='': Alternative image repository to pull docker images from. This can be used when you have
limited access to gcr.io. Set it to "auto" to let minikube decide one for you. For Chinese mainland users, you may use
local gcr.io mirrors such as registry.cn-hangzhou.aliyuncs.com/google_containers
--insecure-registry=[]: Insecure Docker registries to pass to the Docker daemon. The default service CIDR range
will automatically be added.
--interactive=true: Allow user prompts for more information
--iso-url='https://storage.googleapis.com/minikube/iso/minikube-v1.4.0.iso': Location of the minikube iso.
--keep-context=false: This will keep the existing kubectl context and will create a minikube context.
--kubernetes-version='v1.16.0': The kubernetes version that the minikube VM will use (ex: v1.2.3)
--kvm-gpu=false: Enable experimental NVIDIA GPU support in minikube
--kvm-hidden=false: Hide the hypervisor signature from the guest in minikube (kvm2 driver only)
--kvm-network='default': The KVM network name. (kvm2 driver only)
--kvm-qemu-uri='qemu:///system': The KVM QEMU connection URI. (kvm2 driver only)
--memory='2000mb': Amount of RAM allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or
g).
--mount=false: This will start the mount daemon and automatically mount files into minikube.
--mount-string='/home/user:/minikube-host': The argument to pass the minikube mount command on start.
--native-ssh=true: Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh'
command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for
SSH'.
--network-plugin='': The name of the network plugin.
--nfs-share=[]: Local folders to share with Guest via NFS mounts (hyperkit driver only)
--nfs-shares-root='/nfsshares': Where to root the NFS Shares, defaults to /nfsshares (hyperkit driver only)
--no-vtx-check=false: Disable checking for the availability of hardware virtualization before the vm is started
(virtualbox driver only)
--registry-mirror=[]: Registry mirrors to pass to the Docker daemon
--service-cluster-ip-range='10.96.0.0/12': The CIDR to be used for service cluster IPs.
--uuid='': Provide VM UUID to restore MAC address (hyperkit driver only)
--vm-driver='': Driver is one of: [virtualbox parallels vmwarefusion kvm2 vmware none] (defaults to virtualbox)
--wait=true: Wait until Kubernetes core services are healthy before exiting.
--wait-timeout=6m0s: max time to wait per Kubernetes core services to be healthy. Usage:
minikube start [flags] [options] Use "minikube start options" for a list of global command-line options (applies to all commands).
user@slave:~$
minikube start --cpus=2 --disk-size='10g' --image-mirror-country='cn' --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
//国内阿里的google容器源,实话阿里很给力对于国内的有需求的
user@slave:~$ minikube start --disk-size='10g' --image-mirror-country='cn' --image-repository='registry.cn-hangzhou.aliyun
cs.com/google_containers'* minikube v1.4.0 on Ubuntu 16.04
* Using image repository registry.cn-hangzhou.aliyuncs.com/google_containers
* Creating virtualbox VM (CPUs=, Memory=2000MB, Disk=10000MB) ...
* Preparing Kubernetes v1.16.0 on Docker 18.09. ...
* Pulling images ...
* Launching Kubernetes ...
* Waiting for: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
* For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/
user@slave:~$
user@slave:~$
user@slave:~$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
05、测试k8s
user@slave:~$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-67c766df46-59rtb / Running 17m
kube-system coredns-67c766df46-jxmvf / Running 17m
kube-system etcd-minikube / Running 16m
kube-system kube-addon-manager-minikube / Running 16m
kube-system kube-apiserver-minikube / Running 16m
kube-system kube-controller-manager-minikube / Running 17m
kube-system kube-proxy-ljppw / Running 17m
kube-system kube-scheduler-minikube / Running 16m
kube-system storage-provisioner / Running 17m
user@slave:~$
user@slave:~$
user@slave:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 18m v1.16.0
user@slave:~$
user@slave:~$ kubectl get namespaces
NAME STATUS AGE
default Active 18m
kube-node-lease Active 18m
kube-public Active 18m
kube-system Active 18m
minikube国内在线部署体验的更多相关文章
- 免费丨十大IT热门学科在线直播体验课正式来袭,全免费!!!
一场突如其来的疫情阻挡了人与人之间的接触,在这一系列困难面前,无数勇敢的人们挺身而出,千里驰援,默默承担,用行动践行责任与信念,希望与祖国和家人一道共渡难关. 传智播客作为一家致力于“高精尖”IT科技 ...
- Linux系统部署体验中心
Linux系统部署体验中心 安装Linux虚拟机 1. 下载安装VMware,安装64位Linux系统(Ubuntu),要求:CPU双核,2G内存,60G硬盘 2. 安装系统时,选择安装ssh服务 ...
- 实战docker,编写Dockerfile定制tomcat8镜像,实现web应用在线部署
最初在tomcat上部署web应用的方式,是通过maven的maven-compiler-plugin插件先打成war包,再将war包复制到tomcat的webapps目录下,后来用上了tomcat7 ...
- 实战docker,编写Dockerfile定制tomcat镜像,实现web应用在线部署
最初在tomcat上部署web应用的方式,是通过maven的maven-compiler-plugin插件先打成war包,再将war包复制到tomcat的webapps目录下,后来用上了tomcat7 ...
- 在线学习体验大PK 云智慧发布在线教育网站性能监测报告
互联网不但改变了我们的生活.娱乐和消费方式,也推动各行各业进行着快速变革,越来越多的职场人士必须通过不断的学习.充电才能跟上行业发展的步伐,获得职业的提升,而这也引发了国内教育市场的爆炸式发展.据统计 ...
- 【阿里云产品公测】云引擎ACE java DEMO 直接部署体验
作者:阿里云用户啊里新人 本来想根据前几个哥们的公测文章,体验一下,发现他妈的都是php的一下我就,,好吧还有群,群里高手如云,,看着文档(其实文档写的很清晰了!只不过我太懒了!) 哈哈,所以群里 ...
- Anno微服务Viper(控制面板) 支持在线部署
1.Anno简介? Anno是一个微服务框架引擎.入门简单.安全.稳定.高可用.全平台可监控.依赖第三方框架少.可在线升级部署. 2.Viper简介 Viper 是一个基于Anno微服务引擎开发的Da ...
- Rio手把手教学:如何打造容器化应用程序的一站式部署体验
11月19日,业界应用最为广泛的Kubernetes管理平台创建者Rancher Labs(以下简称Rancher)宣布Rio发布了beta版本,这是基于Kubernetes的应用程序部署引擎.它于今 ...
- K8S在线部署含Dashborad
参考文章 https://www.kubernetes.org.cn/5462.html 前言 Kubernetes作为容器编排工具,简化容器管理,提升工作效率而颇受青睐.很多新手部署Kubernet ...
随机推荐
- 泡泡一分钟:Context-Aware Modelling for Augmented Reality Display Behaviour
张宁 Context-Aware Modelling for Augmented Reality Display Behaviour链接:https://pan.baidu.com/s/1RpX6kt ...
- 【嵌入式开发】裸机引导操作系统和ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 )
[嵌入式开发]ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 ) 一. 内存 ...
- NuxtJS实战,一个博客系统
前言 这个项目诞生于17年5月,距今已有两年多了,在这两年期间经历了很多变更,从简单到复杂,又从复杂到简单,并且以后一直会保持这种简单状态.最近迎来了一次更新,因此特意分享一下.虽然只有我一个人使用( ...
- kubernetes之kubelet运行机制分析
kubernetes集群中,每个Node节点工作节点上都会启动一个kubelet服务进程.用于处理master节点下发到本节点的任务,管理pod和pod中的容器.每个kubelet进程都会在API S ...
- springboot自定义类@Resource注入为null的问题
最近用spring boot ,在controller外面即自定义的类里报错 java.lang.NullPointerException debug了下发现@Resource注入为null 查了不少 ...
- 解决chrome浏览器插件开发者模式每次启动要确认弹出框的问题
在日常工作中,我们经常会用到一些浏览器插件,有些插件因为没上架到浏览器的应用商店,只能以开发者模式运行,但是chrome浏览器出了限制,每次重新启动浏览器的时候,就会弹出该插件是否要禁止运行的对话框, ...
- 直击JavaScript之面向对象
有时候,我们使用电脑的时候,并不知道它的原理是什么,但是就是会使用他,这就是面向对象.同样的,在JavaScript中也可使用这种原理,接下来就随我一起探索一下关于JavaScript面向对象的内容吧 ...
- 在ensp上配置RIPv2的认证
原理 实验模拟 实验拓扑 测试连通性 搭建rip网络 查看路由表 R3模拟攻击首先把在自己的的ip通告网段 配置完成后查看一下路由表 可以看到已经非法获取R1R2的网段信息,那么现在我们R3可以向两个 ...
- MATLAB爬虫爬取股票数据
近年来,大数据盛行,有关爬虫的教程层次不穷.那么,爬虫到底是什么呢? 什么是爬虫? 百度百科是这样定义的: 网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种 ...
- 008 SpringCloud 学习笔记4-----Ribbon负载均衡
1.Ribbon概述 实际环境中,我们往往会开启很多个itcast-service-provider的集群.此时我们获取的服务列表中就会有多个,到底该访问哪一个呢? Eureka中已经帮我们集成了负载 ...