甲骨文ARM部署minikube

2025-08-28 30 0

配置:ARM 4核24G

curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-arm64
mv minikube-linux-arm64 /usr/local/bin/minikube
chmod +x /usr/local/bin/minikube

curl -LO https://cdn.dl.k8s.io/release/v1.32.8/bin/linux/arm64/kubectl
mv kubectl /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl

cni配置

mkdir -p /etc/cni/net.d
cat >/etc/cni/net.d/10-mynet.conf <<EOF
{
    "cniVersion": "0.2.0",
    "name": "mynet",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
        "type": "host-local",
        "subnet": "10.22.0.0/16",
        "routes": [
            { "dst": "0.0.0.0/0" }
        ]
    }
}
EOF

cat >/etc/cni/net.d/99-loopback.conf <<EOF
{
    "cniVersion": "0.2.0",
    "name": "lo",
    "type": "loopback"
}
EOF

minikube 下载的plugins为amd64,这里手动下载arm64

minikube start --driver=none --kubernetes-version=v1.32.8 --container-runtime=containerd --network-plugin=cni --cni=flannel --force

cd /opt/cni/bin
wget https://github.com/containernetworking/plugins/releases/download/v1.7.1/cni-plugins-linux-arm64-v1.7.1.tgz
tar xf cni-plugins-linux-arm64-v1.7.1.tgz

minikube delete
root@arm-us:~# minikube start --driver=none --kubernetes-version=v1.32.8 --container-runtime=containerd --network-plugin=cni --cni=flannel --force

* minikube v1.36.0 on Ubuntu 22.04 (arm64)
! minikube skips various validations when --force is supplied; this may lead to unexpected behavior
* Using the none driver based on user configuration
! Using the 'containerd' runtime with the 'none' driver is an untested configuration!
! With --network-plugin=cni, you will need to provide your own CNI. See --cni flag as a user-friendly alternative
* Starting "minikube" primary control-plane node in "minikube" cluster
* Running on localhost (CPUs=4, Memory=23980MB, Disk=148662MB) ...
* OS release is Ubuntu 22.04.5 LTS
* Preparing Kubernetes v1.32.8 on containerd 1.7.24 ...
  - kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
  - Generating certificates and keys ...
  - Booting up control plane ...
  - Configuring RBAC rules ...
* Configuring Flannel (Container Networking Interface) ...
* Configuring local host environment ...
*
! The 'none' driver is designed for experts who need to integrate with an existing VM
* Most users should use the newer 'docker' driver instead, which does not require root!
* For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
*
! kubectl and minikube configuration will be stored in /root
! To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:
*
  - sudo mv /root/.kube /root/.minikube $HOME
  - sudo chown -R $USER $HOME/.kube $HOME/.minikube
*
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
* Verifying Kubernetes components...
  - Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: default-storageclass, storage-provisioner
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
root@arm-us:/opt/cni/bin# kubectl get node
NAME     STATUS   ROLES           AGE   VERSION
arm-us   Ready    control-plane   8s    v1.32.8
root@arm-us:~# kubectl get node
NAME     STATUS   ROLES           AGE   VERSION
arm-us   Ready    control-plane   59s   v1.32.8

root@arm-us:~# kubectl get pod -A
NAMESPACE      NAME                             READY   STATUS    RESTARTS   AGE
kube-flannel   kube-flannel-ds-g92ht            1/1     Running   0          59s
kube-system    coredns-668d6bf9bc-2qmwn         0/1     Running   0          59s
kube-system    etcd-arm-us                      1/1     Running   1          64s
kube-system    kube-apiserver-arm-us            1/1     Running   1          64s
kube-system    kube-controller-manager-arm-us   1/1     Running   1          65s
kube-system    kube-proxy-v4c5n                 1/1     Running   0          59s
kube-system    kube-scheduler-arm-us            1/1     Running   1          64s
kube-system    storage-provisioner              1/1     Running   0          62s
kubectl create deployment nginx-deployment --image=nginx
kubectl expose deployment nginx-deployment --port=80 --target-port=80

nginx-deployment.yaml

vim nginx-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

nginx-service.yaml

vim nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  selector:
    app: nginx
  ports:
    - port: 80
      targetPort: 80
kubectl apply -f nginx-deployment.yaml
kubectl apply -f nginx-service.yaml
root@arm-us:/etc/cni/net.d# kubectl get deployment
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   1/1     1            1           1m30s

root@arm-us:~# kubectl get svc
NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
kubernetes         ClusterIP   10.96.0.1        <none>        443/TCP   6m37s
nginx-deployment   ClusterIP   10.102.192.160   <none>        80/TCP    33s

root@arm-us:~# curl -I 10.244.0.3
HTTP/1.1 200 OK
Server: nginx/1.29.1
Date: Thu, 28 Aug 2025 10:42:36 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Wed, 13 Aug 2025 14:33:41 GMT
Connection: keep-alive
ETag: "689ca245-267"
Accept-Ranges: bytes

root@arm-us:~# curl -I 10.102.192.160
HTTP/1.1 200 OK
Server: nginx/1.29.1
Date: Thu, 28 Aug 2025 10:42:56 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Wed, 13 Aug 2025 14:33:41 GMT
Connection: keep-alive
ETag: "689ca245-267"
Accept-Ranges: bytes

相关文章

kubekey 安装kubernetes 证书100年
ubuntu 22.04 wireguard wg-easy 转发
MySQL 锁表 死锁查看及解决
dify smtp邮箱配置
vcenter 7 克隆虚拟机 ubuntu dhcp ip一样
prometheus 报错 “Out of order sample from remote write” err=”out of bounds”

发布评论