minikube cheap k8s

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/

Reference link

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

Guess you like

Origin blog.csdn.net/xys2015/article/details/112632033