k8s初体验

  |   0 评论   |   0 浏览

背景

k8s的特点

服务发现和负载均衡

  • 每一个容器Pod都有自己的IP地址
  • 对容器集合Pods,支持DNS负载均衡

存储

*. 支持自动挂载存储

  • 支持外部存储,如 GCP, AWS, NFS, iSCSI等

支持滚动发布和回滚

  • 支持滚动发布
  • 支持回滚

批量操作

  • 支持batch操作
  • 支持CI操作

资源自动迁移

  • 资源不满足约束时,支持自动迁移
  • 支持根据负载迁移

健康检查

  • 节点故障时,支持重启和重新调度容器

密钥和配置管理

  • 支持镜像外的密钥的部署和更新

可扩展性

  • 支持通过命令, UI或者负载来弹性扩缩容

minikube体验

minikube是一个单机测试平台,也可以使用浏览器在线上测试。

version

$ minikube version
minikube version: v1.3.0
commit: 43969594266d77b555a207b0f3e9b3fa1dc92b1f

start

$ minibude start
minibude: command not found
$ minikube start
* minikube v1.3.0 on Ubuntu 18.04
* Running on localhost (CPUs=2, Memory=2461MB, Disk=47990MB) ...
* OS release is Ubuntu 18.04.2 LTS
* Preparing Kubernetes v1.15.0 on Docker 18.09.5 ...
  - kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
* Pulling images ...
* Launching Kubernetes ...
* Waiting for: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"

k8s 版本

$ kubectl versionClient Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.2", GitCommit:"f6
278300bebbb750328ac16ee6dd3aa7d3549568", GitTreeState:"clean", BuildDate:"2019-08-05T09
:23:26Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8
462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16
:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

集群版本

$ kubectl cluster-info
Kubernetes master is running at https://172.17.0.67:8443
KubeDNS is running at https://172.17.0.67:8443/api/v1/namespaces/kube-system/services/k
ube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

节点信息

$ kubectl get nodes
NAME       STATUS   ROLES    AGE     VERSION
minikube   Ready    master   4m46s   v1.15.0

k8s初体验

安装k8s

yum -y install etcd kubernetes

参考

https://kubernetes.io/