minikube 安装k8s

本文档详细介绍了如何在Linux环境中安装和配置Minikube,包括安装Docker和kubectl,启动Minikube,并指定国内镜像源。通过Minikube创建的Kubernetes集群状态正常,展示了kubectl获取资源的状态以及运行示例应用的方法。此外,还提供了Minikube配置参数的链接和一些常用命令。
摘要由CSDN通过智能技术生成

minikube

before install minikube , you need install docker and kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

install

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && cp minikube-linux-amd64 /usr/bin/minikube && chmod +x /usr/bin/minikube


minikube start --image-mirror-country=cn  --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' --vm-driver=none

minikube start --image-mirror-country=cn  --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' --vm-driver=none --kubernetes-version='v1.14.0'


kubectl get pods,nodes,services,deployments,statefulsets --all-namespaces

[root@xingyongsheng ~]# minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.1.11
[root@xingyongsheng ~]# minikube version
minikube version: v1.4.0
commit: 7969c25a98a018b94ea87d949350f3271e9d64b6
[root@xingyongsheng ~]# docker images | grep hangzhou
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver            v1.16.0             b305571ca60a        3 weeks ago         217MB
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy                v1.16.0             c21b0c7400f9        3 weeks ago         86.1MB
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager   v1.16.0             06a629a7e51c        3 weeks ago         163MB
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler            v1.16.0             301ddc62b80b        3 weeks ago         87.3MB
registry.cn-hangzhou.aliyuncs.com/google_containers/etcd                      3.3.15-0            b2756210eeab        5 weeks ago         247MB
registry.cn-hangzhou.aliyuncs.com/google_containers/coredns                   1.6.2               bf261d157914        2 months ago        44.1MB
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-addon-manager        v9.0.2              bd12a212f9dc        2 months ago        83.1MB
registry.cn-hangzhou.aliyuncs.com/google_containers/pause                     3.1                 da86e6ba6ca1        22 months ago       742kB
registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner       v1.8.1              4689081edb10        23 months ago       80.8MB
registry.cn-hangzhou.aliyuncs.com/google_containers/echoserver                1.4                 a90209bb39e3        3 years ago         140MB

minikube --help
minikube start --help


official example

kubectl run hello-minikube --image=registry.cn-hangzhou.aliyuncs.com/google_containers/echoserver:1.4 --port=8080
kubectl expose deployment hello-minikube --type=NodePort
minikube service hello-minikube

minikube config

https://minikube.sigs.k8s.io/docs/reference/configuration/minikube/

minikube config view
minikube config set <key> <value>
minikube config set memory 4096

minikube dashboard

minikube nginx test

[root@xingyongsheng minikube]# cat nginx-test-all-service.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
          - name: v1
            mountPath: "/data"
      volumes:
      - name: v1
        hostPath:
          path: /data/minikube-nginx
          type: Directory

---

apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30080
  selector:
    app: nginx

[root@xingyongsheng minikube]# #http://localhost:30080/

参考链接

https://github.com/kubernetes/minikube
https://minikube.sigs.k8s.io/docs/start/linux/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凯尔kyle

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值