ÉèÖÃLinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢
ÉèÖÃlinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢
ÈÝÆ÷ÔÆ¿ª·¢£¨Container Cloud Development£©ÊÇÒ»ÖÖ½«Ó¦ÓóÌÐò¿ª·¢Óë°²ÅÅÇéÐÎÏ໥¸ôÀëµÄÊÖÒÕ¡£ËüʹÓÃÈÝÆ÷»¯ÊÖÒÕ£¬½«Ó¦ÓóÌÐò¼°ÆäÒÀÀµÏî´ò°ü³É¾µÏñ£¬Í¨¹ýÈÝÆ÷ÖÎÀíƽ̨¾ÙÐÐͳһÖÎÀíºÍ°²ÅÅ¡£ÔÚLinuxϵͳÉÏÉèÖÃÈÝÆ÷ÔÆ¿ª·¢ÇéÐεÄÀú³ÌÖУ¬ÎÒÃǽ«»áʹÓÃDockerºÍKubernetesÕâÁ½¸öÊ¢ÐеĿªÔ´¹¤¾ß¡£
ÒÔÏÂÊÇÉèÖÃlinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢µÄ°ì·¨¼°Ïà¹Ø´úÂëʾÀý¡£
°ì·¨1£º×°ÖÃDocker
DockerÊÇÒ»¸öÈÝÆ÷»¯Æ½Ì¨£¬ÎÒÃÇÊ×ÏÈÐèҪװÖÃËü¡£
# ¸üаü¹ÜÀí¹¤¾ß sudo apt-get update # ×°ÖÃDockerÒÀÀµÏî sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common # Ìí¼ÓDocker¹Ù·½GPGÃÜÔ¿ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Ìí¼ÓDockerÈí¼þÔ´ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" # ¸üаü¹ÜÀí¹¤¾ß sudo apt-get update # ×°ÖÃDocker sudo apt-get install -y docker-ce
µÇ¼ºó¸´ÖÆ
°ì·¨2£ºÉèÖÃDocker¾µÏñ¼ÓËÙÆ÷
ΪÁ˼ÓËÙDockerÀÈ¡¾µÏñµÄËÙÂÊ£¬ÎÒÃÇ¿ÉÒÔÉèÖÃDocker¾µÏñ¼ÓËÙÆ÷¡£
# ½¨Éè»ò±à¼DockerÉèÖÃÎļþ sudo nano /etc/docker/daemon.json
µÇ¼ºó¸´ÖÆ
ÔÚ·¿ªµÄÎļþÖУ¬Ìí¼ÓÒÔÏÂÄÚÈÝ£¨¼ÙÉèÎÒÃÇÑ¡ÔñʹÓð¢ÀïÔÆ×÷Ϊ¾µÏñ¼ÓËÙÆ÷£©£º
{ "registry-mirrors": ["https://[YOUR_REGION_ID].mirror.aliyuncs.com"] }
µÇ¼ºó¸´ÖÆ
ÉúÑÄÎļþºó£¬ÖØÆôDockerЧÀÍÒÔʹÉèÖÃÉúЧ¡£
sudo systemctl restart docker
µÇ¼ºó¸´ÖÆ
°ì·¨3£º×°ÖÃKubernetes
KubernetesÊÇÒ»¸öÈÝÆ÷±àÅÅƽ̨£¬ÓÃÓÚÖÎÀíºÍµ÷ÀíÈÝÆ÷»¯Ó¦ÓóÌÐò¡£
# ×°ÖÃKubernetesÒÀÀµÏî sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list # ¸üаü¹ÜÀí¹¤¾ß sudo apt-get update # ×°ÖÃKubernetes sudo apt-get install -y kubelet kubeadm kubectl
µÇ¼ºó¸´ÖÆ
°ì·¨4£º³õʼ»¯KubernetesÖ÷½Úµã
ÔÚKubernetes¼¯ÈºÖУ¬Ò»¸ö½Úµã±»Ö¸¶¨ÎªÖ÷½Úµã£¨Master£©¡£ÎÒÃÇÐèÒª³õʼ»¯¸ÃÖ÷½Úµã¡£
# ³õʼ»¯Ö÷½Úµã sudo kubeadm init --pod-network-cidr=10.244.0.0/16
µÇ¼ºó¸´ÖÆ
³õʼ»¯Íê³Éºó£¬Kubernetes½«»áÌṩһЩÏÂÁÎÒÃÇÔÚºóÐø°²ÅŽڵãʱʹÓ᣼ÇÏÂÕâЩÏÂÁÎÒÃÇ»áÔÚºóÐø°ì·¨ÖÐʹÓá£
°ì·¨5£º×°ÖÃÍøÂç²å¼þ
ÔÚKubernetes¼¯ÈºÖУ¬ÎÒÃÇÐèҪװÖÃÍøÂç²å¼þÒÔʹÈÝÆ÷Ö®¼äÄܹ»Ï໥ͨѶ¡£
# ×°ÖÃÍøÂç²å¼þ£¨ÕâÀïÒÔFlannelΪÀý£© sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
µÇ¼ºó¸´ÖÆ
°ì·¨6£º¼ÓÈë½Úµã
ÏÖÔÚ£¬ÎÒÃǽ«ÆäËûLinuxϵͳ½Úµã¼ÓÈëµ½Kubernetes¼¯ÈºÖС£
# ÔÚÖ÷½ÚµãÖ´Ðа취4µÄÏÂÁîÖУ¬¸´ÖƲ¢ÔËÐÐÊä³öµÄkubeadm joinÏÂÁî¡£ # ÔÚÆäËû½ÚµãÉÏÔËÐÐkubeadm joinÏÂÁîÒÔ¼ÓÈ뼯Ⱥ¡£
µÇ¼ºó¸´ÖÆ
ÖÁ´Ë£¬ÎÒÃÇÒѾÍê³ÉÁËÉèÖÃlinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢µÄÀú³Ì¡£ÏÖÔÚ£¬Äã¿ÉÒÔ×îÏÈʹÓÃÈÝÆ÷ÔÆ¿ª·¢µÄÓÅÊÆÀ´°²ÅźÍÖÎÀíÄãµÄÓ¦ÓóÌÐòÁË£¡
×ܽá
ͨ¹ýÉèÖÃlinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢£¬ÎÒÃÇ¿ÉÒÔÇáËɵØʹÓÃÈÝÆ÷»¯ÊÖÒÕÀ´ÖÎÀíºÍ°²ÅÅÓ¦ÓóÌÐò¡£½èÖúDockerºÍKubernetesÕâÁ½¸öÇ¿Ê¢µÄ¿ªÔ´¹¤¾ß£¬ÎÒÃÇ¿ÉÒÔ¸ü¸ßЧµØ¾ÙÐпª·¢ºÍÔËά¡£Ï£Íû±¾ÎÄÌṩµÄ°ì·¨ºÍ´úÂëʾÀý¶ÔÄãÓÐËù×ÊÖú£¡
ÒÔÉϾÍÊÇÉèÖÃLinuxϵͳÒÔÖ§³ÖÈÝÆ÷ÔÆ¿ª·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡