In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces you how to build a Kubernetes environment in the Mac system, the content is very detailed, interested friends can refer to, hope to be helpful to you.
➜kubernetes docker imagesREPOSITORY TAG k8s.gcr.io/kube-apiserver v1.16.0 registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver v1.16.0 k8s.gcr.io/kube-proxy V1.16.0 registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy v1.16.0 k8s.gcr.io/kube-proxy v1.14.6 k8s.gcr.io/kube-apiserver V1.14.6 k8s.gcr.io/kube-scheduler v1.14.6 k8s.gcr.io/kube-controller-manager v1.14.6 docker/kube-compose-controller v0.4 . 23 docker/kube-compose-api-server v0.4.23 k8s.gcr.io/coredns 1.3.1 k8s.gcr.io/kubernetes-dashboard-amd64 v1.10.1 k8s.gcr.io / etcd 3.3.10 k8s.gcr.io/kube-proxy-amd64 v1.10.11 k8s.gcr.io/kube-apiserver-amd64 v1.10.11 k8s.gcr.io/kube -controller-manager-amd64 v1.10.11 k8s.gcr.io/kube-scheduler-amd64 v1.10.11 docker/kube-compose-controller v0.4.12 docker/kube-compose-api-server V0.4.12 k8s.gcr.io/etcd-amd64 3.1.12 k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64 1.14.8 k8s.gcr.io/k8s-dns-sidecar-amd64 1.14.8 k8s.gcr.io/k8s-dns-kube-dns-amd64 1.14.8 k8s.gcr.io/pause-amd64 3.1 k8s.gcr.io/pause 3.1 k8s.gcr.io/storage-provisioner v1.8.1 registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner v1.8.1
Start it again, and you should see both Docker and Kubernetes up in a moment.
Create kubernetes-dashboard
Next we can use the kubectl command to create a simple kubernetes-dashboard service:
Kubectl apply-f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml# this can download the file, and then it can be local. Kubectl apply-f / Users/chenyuan/Tools/Docker/kubernetes/kubernetes-dashboard.yamlsecret "kubernetes-dashboard-certs" createdserviceaccount "kubernetes-dashboard" createdrole "kubernetes-dashboard-minimal" createdrolebinding "kubernetes-dashboard-minimal" createddeployment "kubernetes-dashboard" createdservice "kubernetes-dashboard" created
After the service is installed, you can view the deployed containers and services:
➜kubernetes kubectl get deployments-namespace kube-systemNAME READY UP-TO-DATE AVAILABLE AGEcoredns 2 4d3hkubernetes-dashboard 1 1 1 3d8h➜ kubernetes kubectl get services-namespace kube-systemNAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkube-dns ClusterIP 10.96.0.10 53/UDP 53cm TCP 4d3hkubernetes-dashboard ClusterIP 9153max TCP 4d3hkubernetes-dashboard ClusterIP 10.96.229.197 443/TCP 4d2h starts dashboard
After Dashboard is started, you can use the Proxy service provided by kubectl to access the panel
Kubectl proxy-address='0.0.0.0'-accept-hosts=' ^ * $'
After starting the service, do not cut off the console, otherwise the service will be interrupted.
Browser input:
Http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
Get Token
Then there are no skipped buttons, so you have to go through Kubeconfig or Token.
I'm here through Token, so how do we know what the value of Token is?
➜kubernetes kubectl get secret-n=kube-systemNAME TYPE DATA AGE...default-token-sznp4 kubernetes.io/service-account-token 3 4d3h...# only default-token-sznp4 is listed here
Just get the token value and enter the resulting value.
➜kubernetes kubectl describe secret-n=kube-system default-token-sznp4Name: default-token-sznp4Namespace: kube-systemLabels: Annotations: kubernetes.io/service-account.name: default kubernetes.io/service-account.uid: 064afefb-ebf6-11e9-ac8c-025000000001Type: kubernetes.io/service-account-tokenData====ca.crt: 1025 bytesnamespace: 11 bytestoken: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkZWZhdWx0LXRva2VuLXN6bnA0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImRlZmF1bHQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiIwNjRhZmVmYi1lYmY2LTExZTktYWM4Yy0wMjUwMDAwMDAwMDEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGVmYXVsdCJ9.u5HTqt7A_4H_0f9ny-AgfmWNo7TSWZsRpjXot1iN8G6oOnt4uDQiS_kiUduwtqqeYC2hjZ2yKPt0NNML9Op1RSAEuTkXiRvJxnCX8GjQeqCD4lzXeqqQ9mTxCVlGijJLaP5VJ2qQtLM0Gwt9eJCYxugGqqHqys7QXdPzcH3WESno0tXNt25klC5ZXNFSeyE-AqLpP3SjmW7W6IBHx89uY28SXmdvTjnCuZyaBlpkgOensdMS7-BpycTzq63NIcp5TR7tM3AdHjsUlSJ2D9YqW_xzMcEDncmjKpbVJ6W9w494L-Z0dOjHkI7gaQSE2Bwi6AqCaGEWKTgMCSWmIBfkrg starts the service through compose's case
I went to Github to find a Demo and ran a few services. Case address: git@github.com:docker/compose-on-kubernetes.git
I copy some of the cases to my own directory, something like this.
➜kubernetes tree-L 2. ├── config-exercise │ └── config-demo ├── db │ ├── Dockerfile │ └── words.sql ├── docker-compose.yml ├── kubernetes-dashboard.yaml ├── web │ ├── Dockerfile │ ├── dispatcher.go │ └── static └── words Dockerfile pom.xml src
Take a look at the docker-compose content.
➜kubernetes cat docker-compose.ymlversion: '3.3'services: web: build: web image: dockerdemos/lab-web ports:-"80:80" words: build: words image: dockerdemos/lab-words deploy: replicas: 5 db: build: db image: dockerdemos/lab-db volumes:-test-volume:/test-volume Verification
Then refresh the page, and you can see that the built nodes can be found on the Kubernetes console.
Use the Docker command to view local services
➜Desktop docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES02d0691dee78 19b138d3318a "docker-entrypoint.s..." 11 minutes ago Up 11 minutes k8s_db_db-0_default_d8be11b3-ef2e-11e9-ac8c-025000000001_0f719b60a99c8 b1e9c4adf655 "java-Xmx8m-Xms8m..." 11 minutes ago Up 11 minutes k8s_words_words-745db75bdf-4slj7_default_d8734615-ef2e-11e9-ac8c-025000000001_04a2ce12bd5e8 b1e9c4adf655 "java-Xmx8m-Xms8m..." 11 minutes ago Up 11 minutes k8s_words_words-745db75bdf-bfz5c_default_d8799138-ef2e-11e9-ac8c-025000000001_0755679d0813b a7ba5776710d "/ dispatcher" 11 minutes ago Up 11 minutes k8s_web_web-8ffd8b7f4-scdmz_default_d86e9b2e-ef2e-11e9-ac8c-025000000001_0ab8bbda27700 b1e9c4adf655 "java-Xmx8m-Xms8m..." 11 minutes ago Up 11 minutes k8s_words_words-745db75bdf-w2dxd_default_d878bdf2-ef2e-11e9-ac8c-025000000001_05c5943bd4f34 b1e9c4adf655 "java-Xmx8m-Xms8m..." 11 minutes ago Up 11 minutes k8s_words_words-745db75bdf-bzdbg_default_d86ebe31-ef2e-11e9-ac8c-025000000001_06e1b7bbffaa9 b1e9c4adf655 "java-Xmx8m-Xms8m..." 11 minutes ago Up 11 minutes k8s_words_words-745db75bdf-2xwgr_default_d87525d6-ef2e-11e9-ac8c-025000000001_0 other commands
After the application stack is created, you can use kubectl to view the created Pods:
Kubectl get pods
You can also view the deployed clusters and services:
Kubectl get deployments
You can see that the web here has the so-called LoadBalancer type, that is, it can provide services to the public. Finally, we can use the stack and kubectl commands to delete the application:
Docker stack remove demo kubectl delete deployment kubernetes-dashboard-namespace kube-system on how to build a Kubernetes environment in the Mac system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.