Docker
- docker build
- docker run
如何做kubectl
https://www.cnblogs.com/xingyys/p/11594189.html
https://cloud.tencent.com/developer/article/1004345
http://localhost/tutorial/our-application/
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://zhuanlan.zhihu.com/p/65559363
https://medium.com/@elliot.kim/visualize-your-kubernetes-cluster-a87f1cafb6fe
https://blog.youkuaiyun.com/weixin_41806245/article/details/99675558?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param
在Mac环境下 setup kubec服务
Make sure the directory is in your system PATH.
export $PATH=~/crc
Let us first understand what shell you you using on mac
“”"
echo $SHELL
/bin/zsh
“”"
Visit the CodeReady Containers downloads page and download the latest macOS-compatible release.
Uncompress the file. The easiest way to do this is to double-click on the file, or use tar.
Make sure the file is where you want it to reside (e.g., ~/crc directory).
Make sure the directory is in your system PATH.
While you at the CodeReady Containers downloads page, go ahead and download the pull secret; the button is just a bit further down the page. This will be used for authentication the first time you start your Kubernetes (OpenShift, actually) cluster.
Installing Kubernetes
Bonus: It’s included in CRC. Wow, that was easy.
Installing kubectl
The Kubernetes command-line tool, kubectl, is a breeze to install on macOS:
“”"
brew install kubernetes-cli
“”"
Installing oc
“”"
brew install openshift-cli
“”"
Note: If, at any time, you want to start fresh with CRC, use the commands crc stop
and
crc delete --force --clear-cache.
You’ll need to run crc setup after that.
To log in the cluster, you can follow the loggings such as
To access the cluster, first set up your environment by following ‘crc oc-env’ instructions.
setup environments:
a. export PATH="/Users/ys46135/.crc/bin/oc:$PATH"
b.
Then you can access it by running ‘oc login -u developer -p developer https://api.crc.testing:6443’.
To login as an admin, run ‘oc login -u kubeadmin -p dpDFV-xamBW-kKAk3-Fi6Lg https://api.crc.testing:6443’.
===========================================================
Image与Container之间的联系?
答:镜像的概念更多偏向于一个环境包,这个环境包可以移动到任意的Docker平台中去运行;而容器就是你运行环境包的实例。你可以针对这个环境包运行N个实例。换句话说container是images的一种具体表现形式。你也可以认为镜像与你装载操作系统iso镜像是一个概念,容器则可理解为镜像启动的操作系统。一个镜像可以启动任意多个容器,即可以装载多个操作系统。
container = running image
============================================================
Creating that first pod
We’ll use a Linux image that I created. Use this command to spin up a pod:
kubectl run qotd --image=quay.io/donschenck/qotd:v2 --port=10000
This will pull an image down from my public repository to your system and run it using Kubernetes.
A little more detail: This creates a pod named qotd, retrieves the image, starts the image in a container, and uses port 10000 to route to it.
Note that the pod name and the name of the image do not need to match. This is an area where you want to put some management thought into place. In other words, this is a great opportunity to make things really confusing if you’re not thoughtful. Don’t ask how I know this.
Note that waiting for this pod to get up and running might take a few minutes, depending on your machine’s performance. When done on a server or high-performance PC, it takes about a minute or so. My MacBook Air with the i5 processor takes about four minutes. You can check on it by running kubectl get pods.
Reaching the application
There are two aspects, if you will, to the proxy that Kubernetes has created. One aspect is the proxy itself. The other aspect is the public face of the proxy, that which allows you to access your pods. In other words, the proxy runs on port 8001, while the proxy routes are what allow you to reach your application.
kubectl proxy 把pod暴露给了command line。
所以,
The proxy is running. This will tie up the command line (i.e., it runs interactively), so you need a second terminal window to run the following command, which will return a list of the proxy routes:
=============================================
来源文章
https://developers.redhat.com/blog/2019/04/15/how-to-set-up-your-first-kubernetes-environment-on-macos/