Kubernetes Running Locally
1. Requirements
1) Linux
Not running Linux? Consider running Minikube, or on a cloud provider like Google Compute Engine.
It recommends Ubuntu16.04.
2) Go
You need go in your path (see here for supported versions), please make sure it is installed and in your $PATH.
It recommends Go1.9.2+.
$ wget https://golang.org/dl/go1.9.2.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
PS: It's better to set environments by adding the following sections into /etc/profile like this:
3) Docker
At least Docker 1.10+. Ensure the Docker daemon is running and can be contacted (try docker ps).
Some of the Kubernetes components need to run as root, which normally works fine with docker.
$ apt-get install docker.io
$ docker env
4) etcd
You need an etcd in your path, please make sure it is installed and in your $PATH.
It recommends etcd3.2.6+.
$ wget https://github.com/coreos/etcd/releases/download/v3.2.6/etcd-v3.2.6-linux-amd64.tar.gz
$ tar -C /usr/local -xzf etcd-v3.2.6-linux-amd64.tar.gz
5) OpenSSL
You need OpenSSL installed. If you do not have the openssl command available, the script will print an appropriate error.
$ apt-get install openssl
6) CFSSL
The CFSSL binaries (cfssl, cfssljson) must be installed and available on your $PATH.
The easiest way to get it is something similar to the following:
$ apt-get install build-essential
$ go get -u github.com/cloudflare/cfssl/cmd/...
PS: This command will download and build cfssl packages into $GOPATH/bin
2. Networking
Kubernetes is using CNI as the networking plugin, like flannel,dhcp,loopback and so forth.
1) Build CNI
$ go get github.com/containernetworking/plugins/...
PS: This command will download and build CNI packages into $GOPATH/bin
2) Add Conf
$ mkdir -p /etc/cni/net.d
3. Kubernetes
1) Download
$ git clone https://github.com/kubernetes/kubernetes.git
2) Build
$ cd kubernetes
$ make
3) Set Env
set environments by adding the following sections into /etc/profile like this:
4) Run
$ cd kubernetes
$ hack/local-up-cluster.sh # Build and Run
$ hack/local-up-cluster.sh -O # Already build and Run
5) Test
$ cluster/kubectl.sh get pods
$ cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80
## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal
$ docker images
## you should see it pulling the nginx image, once the above command returns it
$ docker ps
## you should see your container running!
exit
## end wait
## introspect Kubernetes!
$ cluster/kubectl.sh get pods
PS: The following docker images will be automatically download.
They can be shown by command "docker images".
Actually these containers will be run to provider the Kubernetes DNS Cluster Service.
gcr.io/google_containers/k8s-dns-sidecar-amd64
gcr.io/google_containers/k8s-dns-kube-dns-amd64
gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64
gcr.io/google_containers/pause-amd64
4. Trouble Shooting
1) swap
- Error
Running with swap on is not supported, please disable swap!
- Solution
* Identify configured swap devices and files with cat /proc/swaps.
* Turn off all swap devices and files with swapoff -a.
* Remove any matching reference found in /etc/fstab.
* Optional: Destroy any swap devices or files found in step 1 to prevent their reuse.
* Due to your concerns about leaking sensitive information, you may wish to consider performing some sort of secure wipe.
2) Improvement
$ vi s.sh
~/go/src/kubernetes/hack/local-up-cluster.sh -O
$ source s.sh # simply to run kubernetes server
$ cp kubernetes/_output/bin/kubelet /usr/local/bin/
$ kubelet # simply to replace cluster/kubectl.sh into kubelet
$ alias k=kubectl
3) Improvement
# export SERVICE_ACCOUNT_LOOKUP=false
# export NET_PLUGIN=kubenet #just for gce
$ kubectl exec POD_NAME -it /bin/bash
$ kubectl logs
$ kubectl cluster-info dump
Kubernetes Running Locally的更多相关文章
- 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...
- 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...
- 关于Kubernetes(简称K8S)的开启及基本使用,基于Docker Desktop & WSL2
背景介绍 Kubernetes(简称k8s)已成为目前业界容器编排的事实标准,其搭配Docker可建立非常高效便捷的高可扩展.高可用应用服务架构. Kubernetes的名字来自希腊语,意思是&quo ...
- Announcing the public preview of Azure Dev Spaces
Today, we are excited to announce the public preview of Azure Dev Spaces, a cloud-native development ...
- docker官方文档学习-1-Docker for mac安装配置
https://docs.docker.com/docker-for-mac/ Get started with Docker for Mac 首先像在本博客docker-1-环境安装及例子实践处将环 ...
- Distributed Phoenix Chat with PubSub PG2 adapter
转自:https://www.poeticoding.com/distributed-phoenix-chat-with-pubsub-pg2-adapter/ In this article we’ ...
- spark源码分析以及优化
第一章.spark源码分析之RDD四种依赖关系 一.RDD四种依赖关系 RDD四种依赖关系,分别是 ShuffleDependency.PrunDependency.RangeDependency和O ...
- [转]gitlab ci/cd 发布
转自 https://meigit.readthedocs.io/en/latest/configure_gitlab_i18n_and_create_gitlab_ci_with_gitlab_ru ...
- 在PC上测试移动端网站和模拟手机浏览器的5大方
查了很多资料,尝试了大部分方法,下面将这一天的努力总结下分享给大家,也让大家免去看那么多文章,以下介绍的方法,都是本人亲自测试成功的方法,测试环境winxp. 一.Chrome*浏览器 chrome模 ...
随机推荐
- 启动samba服务--ubuntu 14.04
1. 修改配置文件 /etc/samba/smb.conf文件末尾添加 [homes] comment = Home Directories browseable = yes read only = ...
- 编写高质量代码改善C#程序的157个建议——建议70:避免在调用栈较低的位置记录异常
建议70:避免在调用栈较低的位置记录异常 并不是所有的异常都要被记录到日志,一类情况是异常发生的场景需要被记录,还有一类就是未被捕获的异常.未被捕获的异常通常被视为一个Bug,所以,对于它的记录,应该 ...
- mybatis_入门程序
Mybatis入门 (一).程序环境 1.jar包 2.classpath目录下建立SqlMapConfig.xml. mybatis的配置文件.全部设置有如下 同时,数据库的参数可以用propert ...
- 【小梅哥SOPC学习笔记】给NIOS II CPU增加看门狗定时器并使用
给NIOS II CPU增加看门狗定时器并使用 配置看门狗定时器: 1. 设置计时溢出时间为1秒 2. 计数器位宽为32位 3. 勾选No Start/Stop control bits 4. 勾选F ...
- Delphi xe5 控件TIdhttp的用法post,get解决中文乱码问题
网络接口如下图: 浏览器演示如下:http://xxx.xxx.xxx.xxx/web/login!doLogin?data={"password":"yy123&quo ...
- Verilog MIPS32 CPU(八)-- 控制器
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- 前台通过form表单向Django后台传输数据,Django处理后返回给前台
摘要:Django前后台数据传递 通过action将数据传输给apitest这个地址,使用get方法传递,此处需要传递name="request_method"的下拉列表值和nam ...
- webservice 创建及调用
1.创建一个空白项目 2.在此项目上新建项--添加一个web服务 (.asmx) 这样就创建好了一个webservice --------------------------------------- ...
- UVA 10881
题目就不再写了,直接开始 [分析]蚂蚁碰撞掉头,其实不用考虑掉头问题,直接让“掉头”等价于“对穿而过”, 然后调换它们的状态(感觉像是障眼法hhh),只要分清楚“谁是谁”.因为“掉头”,所以蚂蚁 的相 ...
- Mysql 索引原理《一》索引原理与慢查询2
一 索引未命中 并不是说我们创建了索引就一定会加快查询速度,若想利用索引达到预想的提高查询速度的效果,我们在添加索引时,必须遵循以下问题 1 范围问题,或者说条件不明确,条件中出现这些符号或关键字:& ...