欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

国内环境部署使用minikube部署k8s

程序员文章站 2022-07-13 21:34:57
...
minikube start --vm-driver=none --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers

安装helm客户端

##[https://helm.sh/docs/intro/install/](https://helm.sh/docs/intro/install/)

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

查看clusters

[[email protected] ~]# kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /root/.minikube/ca.crt
    server: https://10.0.2.15:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /root/.minikube/client.crt
    client-key: /root/.minikube/client.key

实例

[[email protected] ~]# kubectl create deployment hello-minikube   --image=registry.cn-hangzhou.aliyuncs.com/google-containers/echoserver:1.4
deployment.apps/hello-minikube created
[[email protected] ~]# kubectl expose deployment hello-minikube --type=NodePort --port=8080
service/hello-minikube exposed
[[email protected] ~]# minikube service hello-minikube

|-----------|----------------|-------------|------------------------|
| NAMESPACE |      NAME      | TARGET PORT |          URL           |
|-----------|----------------|-------------|------------------------|
| default   | hello-minikube |             | http://10.0.2.15:30080 |
|-----------|----------------|-------------|------------------------|
* Opening service default/hello-minikube in default browser...