13篇 k8s related articles

failed to pull image k8s.gcr.io/kube-apiserver:v1.16.0...

虚拟机内使用minikube start --vm-driver=none装minikube时,报的这个

[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-apiserver:v1.16.0: output: Trying to pull repository k8s.gcr.io/kube-apiserver ...
Get https://k8s.gcr.io/v1/_ping: dial tcp 64.233.189.82:443: connect: connection refused
, error: exit status 1

实际上就是这个域名k8s.gcr.io不通。
可以执行minikube start --vm-driver=none --image-mirror-country=cn; 来指定国内镜像源。

More ~

容器化之路 - 面对一堆yml配置我很茫然

对于容器的配置文件, docker-compose的还好理解,但是一到k8s,就有很多对象, pods, nodes, services, deployment... 每个基本上都有个yml的定义,其中的参数一看一脸茫然。

还好找到这个:kubectl explain xxx 可以看它的定义

kubectl explain service --recursive 可以查看service定义的所有定段。
kubectl explain svc.metadata.uid 可以查看某个字段的定义

当然,k8s官方也有一些examples: https://github.com/kubernetes/examples

More ~

macos 搭建 Kubernetes (k8s)

先安装macos桌面版的docker

  1. brew install kubernetes-cli --verbose

  2. 安装virtualbox

  3. brew cask install minikube
    如果有墙内,可以安装阿里云的版本
    curl -Lo minikube http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.1.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

  4. 启动minikube
    minikube start --registry-mirror=https://registry.docker-cn.com

  5. (可选)dashboard
    minikube dashboard

More ~